[Wolves] sql query ;-)

sparkes sparkes at westmids.biz
Tue Jun 22 09:26:04 BST 2004


The artist formally known as Jon Farmer was heard to say...
>


> You are using the wrong type of join, you need a right join not a left
> join
>
> select c.name as Category, count(p.CatID) as CountOfProducts from product
> as p right join Category as c on p.CatID = c.CatID group by c.name order
> by CountOfProduct asc;
>

cheers Jon, I went to bed at about 2 o'clock and immediatly got up and
changed to a right join ;-) it's amazing how the act of lying down can
solve a problem.

The mad thing is I left that query and did about 10 other things before I
went to bed and wasn't even thinking of it.

Thanks anyway, if anyone has a php/sql query cut out the middleman and
just email Mr Farmer directly, but don't tell him I sent you ;-)

>
> Jon
>
>

sparkes




More information about the Wolves mailing list