Re: A select DISTINCT query? - Mailing list pgsql-general

From Tino Wildenhain
Subject Re: A select DISTINCT query?
Date
Msg-id 479C923E.1030002@wildenhain.de
Whole thread Raw
In response to A select DISTINCT query?  (Phil Rhoades <phil@pricom.com.au>)
Responses Re: A select DISTINCT query?  (Phil Rhoades <phil@pricom.com.au>)
List pgsql-general
Phil Rhoades wrote:
> People,
>
> I want to select from a table ONLY unique records ie if a column has
> values:
>
> 1
> 2
> 3
> 3
> 4
> 5
>
> I want ONLY these records returned:
>
> 1
> 2
> 4
> 5


SELECT count(*) as cnt,a,b,c FORM yourtable
GROUP BY a,b,c
HAVING cnt=1

should do.

Regards
Tino

pgsql-general by date:

Previous
From: "Pavel Stehule"
Date:
Subject: Re: A select DISTINCT query?
Next
From: Phil Rhoades
Date:
Subject: Re: A select DISTINCT query?