View Single Post
Old 07-16-2004, 01:33 PM  
M_M
Confirmed User
 
Join Date: May 2004
Posts: 1,167
Quote:
Originally posted by Varius
Thanks!! This works, but now I have a final argument for the WHERE clause to add that's not working.

table1 also has this field:
uid int unsigned not null key

So how can I get the above, matching UID as well?

I tried this:

SELECT t1.campaign_id, t2.revenue FROM table1 t1 LEFT JOIN table2 t2 ON t1.campaign_id=t2.campaign_id WHERE ((t2.year=2004 AND t2.month=12) OR t2.campaign_id IS NULL) AND t1.uid=851

however it only returns me the rows from table1 which are NOT in table2.
SELECT t1.campaign_id, t2.revenue FROM table1 t1 LEFT JOIN table2 t2 ON t1.campaign_id=t2.campaign_id WHERE (t2.year=2004 AND t2.month=12 AND t1.uid=851) OR t2.campaign_id IS NULL
M_M is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote