I ended up using this
select c.categoryID
, categoryname
, count(s.storyID) as stories
from tblcategory as c
left outer
join tblstory as s
on c.categoryID
= s.categoryID
group
by c.categoryID
, categoryname
order
by categoryname asc
But I am going to go ahead and give you the 50 points.
Thanks for the response.
Main Topics
Browse All Topics





by: sigmaconPosted on 2004-10-23 at 22:55:19ID: 12391721
Try this query to get categories and and the story count. Instead of trying to print #RecordCount# you need to print #numberOfStories# when <cfoutput>ting the query
SELECT
c.categoryname,
c.categoryID,
(SELECT count(s.storyID) FROM tblstory as s WHERE c.categoryID = s.categoryID) as numberOfStories
FROM tblCategory as c
ORDER BY categoryname ASC