[Wolves] sql query ;-)

Andrew Roberts ar at nooneishere.co.uk
Mon Jun 21 23:52:38 BST 2004


On Mon, 21 Jun 2004 23:13:59 +0100 (BST), sparkes <sparkes at westmids.biz>  
wrote:

> "select count(*) as count, Category.CatID, Category.name from Category
> left join product on product.CatID = Category.CatID group by
> Category.CatID order by count desc"

The problem is with the count(*) as the left join will produce rows
for the id's that have no corresponding entries in the other table.

you should be able to change it to count(product.CatID) and get the
desired result.
-- 
Andrew Roberts                              ASCII ribbon campaign /"\
ar AT nooneishere.co.uk                      - against HTML email \ /
                                               http://arc.pasp.de/  X
================================================================= / \



More information about the Wolves mailing list