Problems with distinct
От | Andreas Joseph Krogh |
---|---|
Тема | Problems with distinct |
Дата | |
Msg-id | 200602132019.30393.andreak@officenet.no обсуждение исходный текст |
Ответы |
Re: Problems with distinct
|
Список | pgsql-sql |
Any idea why this works: SELECT distinct(g.groupname), g.id, g.p_id FROM onp_group g, onp_group g2 WHERE g.id IN(SELECT g2.id UNION SELECT group_id FROM onp_group_children WHERE child_id = g2.id) AND g2.id IN(1,2,109,105, 112); And not this: SELECT g.id, g.p_id, distinct(g.groupname) FROM onp_group g, onp_group g2 WHERE g.id IN(SELECT g2.id UNION SELECT group_id FROM onp_group_children WHERE child_id = g2.id) AND g2.id IN(1,2,109,105, 112); The *only* difference is that the distinct-clause changed place... -- Andreas Joseph Krogh <andreak@officenet.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 | | ------------------------+---------------------------------------------+
В списке pgsql-sql по дате отправления: