MySQL Forums
Forum List  »  Newbie

Re: Help a newbie revise his faulty query!
Posted by: Paul Gowar
Date: February 18, 2005 03:50AM

Hi Cam,

Try using left join.

SELECT xPsuCategories.cat_name, COUNT(xPsuClassfieds.cat_id )
FROM xPsuCategories
LEFT JOIN xPsuClassifieds ON xPsuCategories.cat_id = xPsuClassfieds.cat_id
GROUP BY xPsuCategories.cat_name;

That way the category will show even when there is no list item.

Cheers
Paul

Options: ReplyQuote


Subject
Written By
Posted
Re: Help a newbie revise his faulty query!
February 18, 2005 03:50AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.