Posted by not_on on 10/31/05 00:17
On Thu, 27 Oct 2005 11:18:21 +0200, Stefan Rybacki
<stefan.rybacki@gmx.net> wrote:
>> got it working nearly :(
>>
>> select count(t1) as count,t2.* from t1,t2 where t1.id=ID and
>> t2.id=ID group by t1.id order by count
>>
>> BUT this only shows results from table 1 that also have soemhting in
>> table two... I need to show all results of table one even if nothing
>Use a LEFT JOIN!
> select count(t1) as count,t2.* from t1 LEFT JOIN t2 ON (t1.id=ID and
> t2.id=ID) group by t1.id order by count
That now works perfectly.. many thanks.
Why will it not accept a wildcard in count such as count( t1.*)
instead it needs a collum name.. not important.. just unexpected:)
I do have MySQL by Paul DuBois and its looking a bit ragged now I
have used it so much.. I just can't seem to get my head around the
join ..erk :( More reading and more testing I guess.
Many many thanks for your answer Stefan . Much appreciated.
[Back to original message]
|