Re: please help me in this query ( add condition to count())
Posted by: Rick James
Date: February 07, 2010 01:23PM

Give this a try:
SELECT  c.catname, SUM(p.active = 1) AS numposts
    FROM  categories AS c
    LEFT JOIN  posts AS p  ON c.catid = p.catid
    GROUP BY  c.catname

(Recommend you switch to 'General' or 'Newbie' forum.)

Options: ReplyQuote


Subject
Written By
Posted
Re: please help me in this query ( add condition to count())
February 07, 2010 01:23PM


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.