Re: How to find records with the same field?

Поиск
Список
Период
Сортировка
От Michael Kleiser
Тема Re: How to find records with the same field?
Дата
Msg-id 40FCFB82.3060004@webde-ag.de
обсуждение исходный текст
Ответ на Re: How to find records with the same field?  ("Joost Kraaijeveld" <J.Kraaijeveld@Askesis.nl>)
Ответы Re: How to find records with the same field?
Список pgsql-general
You can find the duplicates with a self-join:

select t1.col1, t1.col2, t1.col3, t1.col4
  from table1 as t1, table1 as t2
  where
  t1.oid != t2.oid
  t1.col1 = t2.col1 and
  t1.col2 = t2.col2 and
  t1.col3 = t2.col3
  order by t1.col4;



Joost Kraaijeveld schrieb:
> Thanks everyone for answering. Apparently my question was not clear enough.
>
> I want something like this:
>
> select col1, col2,col3, col4
> from table1
> where
> col1 =col1 and
> col2 = col2 and
> col3 = col3
> order by col4
>
> But if I run this query I get all the records in the table and not just the (double) ones with the same columns.
>
> TIA
>
> Joost
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org


В списке pgsql-general по дате отправления:

Предыдущее
От: Lars Erik Thorsplass
Дата:
Сообщение: Stored procedures and "pseudo" fields..
Следующее
От: Michael Kleiser
Дата:
Сообщение: Re: How to find records with the same field?