View Single Post
Old 07-16-2004, 01:31 PM  
Varius
Confirmed User
 
Industry Role:
Join Date: Jun 2004
Location: New York, NY
Posts: 6,890
Quote:
Originally posted by M_M
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
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.
Varius is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote