On 20 Mar 2006, at 12:34, Ian M. Jones wrote:

select xcat.Category, count(xc.CaseID) as NumCases
from Category as xcat
left join Cases as xc on xcat.CategoryID = xc.CategoryID
where xc.CaseID in (3145)
group by xcat.Category
order by xcat.Category
;


Apparently the where clause was dropping the null results, re-written like the following using an "and" on the join rather than a "where" works:

select xcat.Category, count(xc.CaseID) as NumCases
from Category As xcat
left join Cases as xc on xcat.CategoryID = xc.CategoryID
and xc.CaseID in (3145)
group by xcat.Category
order by xcat.Category
;

--
Ian M. Jones
___________________________________
IMiJ Software
http://www.imijsoft.com
http://www.ianmjones.net (blog)


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to