Re: Select distinct question ... complicated

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: The Pennant Shop <vicmogroup(at)yahoo(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Select distinct question ... complicated
Date: 2003-08-06 19:25:48
Message-ID: 20030806192548.GA29592@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 06, 2003 at 12:05:47 -0700,
The Pennant Shop <vicmogroup(at)yahoo(dot)com> wrote:
> Hi ,
>
> I have a table:
> item location
> aaa 10
> aaa 20
> bbb 10
> bbb 10
> ccc 10
> ccc 20
>
> I need to select distinct items where locations are
> the same. So result set should look like:
> item loation
> bbb 10
> Already spent 7 hours on this one.

select item, location from table group by item, location having count(*) > 1;

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2003-08-06 20:06:37 splitting logs, loading logs to table
Previous Message Darcy Buskermolen 2003-08-06 19:21:10 Re: Select distinct question ... complicated