Re: How to find records with the same field?
| От | Peter Alberer |
|---|---|
| Тема | Re: How to find records with the same field? |
| Дата | |
| Msg-id | 000301c46e40$c9de5510$5be0d089@ekelhardt обсуждение исходный текст |
| Ответ на | How to find records with the same field? ("Joost Kraaijeveld" <J.Kraaijeveld@Askesis.nl>) |
| Список | pgsql-general |
Hi joost,
I think the following should work:
include the table 2 times in your query and join the two instances in
the query by the 3 columns.
Example:
Select
t1. column4, t1.column1, t1.column2, t1.column3
From
yourtable t1, yourtable t2
Where
t1.column1 = t2.column1
and t1.column2 = t2.column2
and t1.column3 = t2.column3
order by
t1.column4;
>-----Ursprüngliche Nachricht-----
>Von: pgsql-general-owner@postgresql.org [mailto:pgsql-general-
>owner@postgresql.org] Im Auftrag von Joost Kraaijeveld
>Gesendet: Dienstag, 20. Juli 2004 11:39
>An: pgsql-general@postgresql.org
>Betreff: [GENERAL] How to find records with the same field?
>
>I have a table with column1, column2, column3 and column4. How do I get
all
>records, sorted by column4 that have the same column1,column2 and
column3?
>
>TIA
>
>
>
>Joost
>
>
>---------------------------(end of
broadcast)---------------------------TIP
>9: the planner will ignore your desire to choose an index scan if your
>joining column's datatypes do not match
В списке pgsql-general по дате отправления: