|
Posted by rbaba on 07/24/05 15:22
THX Stefan,
It works !
"Stefan Rybacki" <stefan.rybacki@gmx.net> a ιcrit dans le message de news:
3khdufFugjj4U3@individual.net...
>>
>> Use an OUTER JOIN
>>
>> SELECT a.articleid, a.categoryid, a.userid, a.title, c.name,
>> u.firstname,
>> count(co.commentid) as nb
>> FROM articles a LEFT OUTER JOIN categories c ON
>> a.articleid=co.articleid, users u, comments co
>> WHERE (c.categoryid = a.categoryid AND u.userid = a.userid) AND
>> (co.articleid =
>> a.articleid OR co.articleid IS NULL) GROUP BY a.articleid
>>
>>
>> (untested)
>>
>> Regards
>> Stefan
>
>
> Sorry, query is wrong:
>
> SELECT a.articleid, a.categoryid, a.userid, a.title, c.name,
> u.firstname,
> count(co.commentid) as nb
> FROM articles a, categories c, users u LEFT OUTER JOIN comments co ON
> co.articleid=a.articleid
> WHERE (c.categoryid = a.categoryid AND u.userid = a.userid) AND
> (co.articleid =
> a.articleid OR co.articleid IS NULL) GROUP BY a.articleid
[Back to original message]
|