Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: stored proc/join problem


Message #1 by carl@o... on Wed, 20 Feb 2002 09:07:22
Close!
what worked was:

'WHEN Codes.Criteria_ID is Null' as it is the codes file that doesn't 
necessarily have to have a criteria attached...

Obviously I also had to add Codes.Criteria_ID to the 'Group By' clause as 
well...



Cheers,

Carl


> Select Criteria.Criteria_ID, CriteriaDesc, 
>      Case
>        When Criteria.Criteria_ID Is Null then 0
>        Else  (Count(Criteria_ID))
>      End As CodeCount
> From Criteria 
>  Left Outer Join Codes 
>      ON Criteria.Criteria_ID = Codes.Criteria_ID
> GROUP BY Criteria.Criteria_ID, CriteriaDesc
> ORDER BY CriteriaDesc ASC

  Return to Index