Quote
AND (d.as_of_date = (SELECT max(as_of_date) from finance)
And d.as_of_date <= (a.sent_email_date::date + interval '2 weeks'))
this isn't going to look at dates within two weeks, and the local max of the group. this is finding the absolute max in the finance table (regardless of joins). the bolded is a single date for the entire table regardless of all conditions.