Re: filtering out doubles with SELECT - Mailing list pgsql-novice

From Jules Alberts
Subject Re: filtering out doubles with SELECT
Date
Msg-id 20030312111147.B52B41CB1A5@koshin.dsl.systemec.nl
Whole thread Raw
In response to filtering out doubles with SELECT  ("Jules Alberts" <jules.alberts@arbodienst-limburg.nl>)
Responses Re: filtering out doubles with SELECT  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-novice
> I was wondering how to filter out double values (where "value" spans
> two columns COL1 and COL2) with a SELECT statement. If I have this
> table:
>
> COL1 |COL2 |COL3
> -----------------------------
> a    |b    |some value
> a    |b    |another value
> a    |c    |yet another value
>
> what would be the select statement to get this result:
>
> COL1 |COL2 |COL3
> -----------------------------
> a    |b    |some value
> a    |c    |yet another value

Sorry for answering myself, I already found it:

select * from tbl t1 where not exists (select * from tbl t2 where
t1.COL1=t2.COL1 and t1.COL2=t2.COL2 and t1.oid <> t2.oid)


pgsql-novice by date:

Previous
From: "Jules Alberts"
Date:
Subject: filtering out doubles with SELECT
Next
From: Muhammad Shariq Muzaffar
Date:
Subject: create function pl/pgsql c langauge