Need help with outer join ..

Jul 15 2004 9:35 AM
Hello there, I have 2 tables: Table: Leads ------------------ ID LDate ClientID 1 04/02/2004 101 2 04/03/2004 103 3 04/04/2004 104 .... Table: Tracking ------------------ ID TDate ClientID Shown Clicked 1 04/02/2004 101 3 2 2 04/03/2004 103 5 4 3 04/04/2004 101 3 9 .... I need a query to display results for any Client ID like this: Date Leads Shown Clicked ============================= 04/02/2004 1 3 2 04/04/2004 0 3 9 ..... ============================= The following query doesn't work, it display 1 in leads column instead of 0: select t.Tdate, count(l.id) as Leads, sum(t.shown) as Views from tracking t left outer join Leads l on r.clientid = t.clientid where l.clientid = 101 and l.Ldate >= 'April 2,2004' and t.Tdate >= 'April 2,2004' group by t.Tdate Thanks a lot for your time and help in advance.

Answers (1)