Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to include proper records?

Author  Topic 

Cyclonik
Posting Yak Master

114 Posts

Posted - 2001-02-26 : 16:04:38
Take this query:
SELECT SUM(CASE b.Score WHEN 1 THEN 1 ELSE 0 END) as Exceptions,
COUNT(distinct c.monitor_id) as TotalMonitors,
a.lanid,a.Fname,a.Lname,
SUM(b.points) as TotalScore,
COUNT(b.monitor_id) as TotalAnswered,
AVG(b.points) as Average

FROM tblUsersT a
LEFT JOIN tblVoice_MonitorsT c
ON a.lanid=c.lanid
LEFT JOIN tblVoice_monitor_scores_idx b
ON c.monitor_id=b.monitor_id
WHERE a.managerid = 'bowens' AND c.monitor_date BETWEEN '01/01/01' AND '02/28/01'
GROUP BY a.Lname,a.Fname,a.lanid


The problem is i want all the records from table a returned which match the where criteria "a.managerid = 'bowens'"
and join the data from table c if there is any. This Query is returning only the records from table c that pass the Where condition for table c. hope that makes sense

thanks
Christian

-=:SpasmatiK:=-
   

- Advertisement -