|
Posted by Xavier Houppertz on 06/24/05 19:06
Hello,
I'm not sure how you see this, so here is my whole query ...
Thanks for your help.
xavier
SELECT nuke_users.pn_uid AS "Uid", nuke_users.pn_name AS "Nom", count(
ed_rent.pn_uid ) AS "#"
FROM ed_rent
INNER JOIN nuke_users ON nuke_users.pn_uid = ed_rent.pn_uid WHERE
ed_date_sent IS NULL AND ed_date_return IS NULL GROUP BY ed_rent.pn_uid
UNION SELECT nuke_users.pn_uid, nuke_users.pn_name, count( ed_rent.pn_uid )
FROM ed_rent INNER JOIN nuke_users ON nuke_users.pn_uid = ed_rent.pn_uid
WHERE ed_date_return IS NULL AND ed_date_sent IS NOT NULL AND ed_lost = 0
GROUP BY ed_rent.pn_uid ORDER BY "Uid" ASC , "#" DESC
"Matthias Hoys" <idmwarpzone_NOSPAM_@yahoo.com> wrote in message
news:42b8886f$0$337$ba620e4c@news.skynet.be...
>
> "Xavier Houppertz" <houppertzx@yahoo.com> wrote in message
> news:wbSte.287781$Uh3.71153@biebel.telenet-ops.be...
>> Hello,
>>
>> I am experiencing problems in writing an sql query.
>> I would like to do a select count (pn_uid) where pn_did > 10 AND where
>> pn_did > 500 goup by and sort by
>>
>> Of course if i do this I get everything that is above 500 (say 75)
>>
>> But I would like a result like Uid >10 >500
>> 18 25 75
>>
>> I tried UNION, but I get two lines
>> Uid Tot
>> 18 25
>> 18 75
>>
>> And i would like one ....
>>
>> Ideas please ?
>>
>> thanks,
>> Xavier
>>
>>
>
> Maybe you can do a SELECT on your UNION query ?
>
> SELECT ... FROM
> (SELECT ... FROM ... WHERE pn_did > 10
> UNION
> SELECT ... FROM ... WHERE pn_did > 500
> )
>
Navigation:
[Reply to this message]
|