From: | Andreas Joseph Krogh <andreak(at)officenet(dot)no> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Help with UNION query |
Date: | 2005-09-04 18:08:20 |
Message-ID: | 200509042008.21080.andreak@officenet.no |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Replying to my self...
Here's a somewhat simpler version without the IN-queries:
SELECT g.id
from onp_group g, onp_user_group ug
where g.groupname = ug.groupname AND ug.username = 'andreak'
UNION
SELECT gc.child_id
FROM onp_group_children gc, onp_group g, onp_user_group ug
WHERE gc.group_id = g.id AND g.groupname = ug.groupname
AND ug.username = 'andreak';
But I would very much appreciate if someone manages to rewrite this query so
that it doesn't specify ug.username='anderak' twice.
--
Andreas Joseph Krogh <andreak(at)officenet(dot)no>
Senior Software Developer / Manager
gpg public_key: http://dev.officenet.no/~andreak/public_key.asc
------------------------+---------------------------------------------+
OfficeNet AS | The most difficult thing in the world is to |
Hoffsveien 17 | know how to do a thing and to watch |
PO. Box 425 Skøyen | somebody else doing it wrong, without |
0213 Oslo | comment. |
NORWAY | |
Phone : +47 22 13 01 00 | |
Direct: +47 22 13 10 03 | |
Mobile: +47 909 56 963 | |
------------------------+---------------------------------------------+
From | Date | Subject | |
---|---|---|---|
Next Message | Andreas Joseph Krogh | 2005-09-04 18:54:00 | Re: Help with UNION query |
Previous Message | Andreas Joseph Krogh | 2005-09-04 17:14:25 | Help with UNION query |