The code below works just fine in an asp emailer as it loops through the DB. A BIG thank you goes out to BigMike1212 for helping me with this code.
I now want to add one more condition from another table (table3) and can't figure out how to add another select statement to the above code. I want to add:Code:strSQL = "SELECT id,name, email, max(issueddate) AS max_date FROM (SELECT table1.id,table1.name as name, table1.email AS email, table2.issueddate AS issueddate FROM table1 INNER JOIN table2 ON table1.id=table2.id WHERE table1.remove is null and (table1.id >= '"& id1 &"' and table1.id <= '"& id2 &"') and month(table2.issueddate) between month('" & dDateFrom & "') and month('" & dDateTo & "')) AS a GROUP BY id, name, email ORDER BY 1"
in addition to where the SUM of id = '0' (id is in table 1,2 and 3) (id equals the customer id)Code:SELECT SUM (Credits) from Table3 where date > '1/1/2012'
What I want to accomplish is for emails to be sent to all in the very top code except for customers that have already made a purchase.
I would appreciate your help. Thanks


(right side on this reply ) and agree

