Re: How to find records with the same field? - Mailing list pgsql-general

From Peter Alberer
Subject Re: How to find records with the same field?
Date
Msg-id 000301c46e40$c9de5510$5be0d089@ekelhardt
Whole thread Raw
In response to How to find records with the same field?  ("Joost Kraaijeveld" <J.Kraaijeveld@Askesis.nl>)
List 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 by date:

Previous
From: Devrim GUNDUZ
Date:
Subject: Re: How to find records with the same field?
Next
From: "Joost Kraaijeveld"
Date:
Subject: Re: How to find records with the same field?