Re: Select distinct question ... complicated

From: Darcy Buskermolen <darcy(at)wavefire(dot)com>
To: The Pennant Shop <vicmogroup(at)yahoo(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Select distinct question ... complicated
Date: 2003-08-06 19:21:10
Message-ID: 200308061221.10570.darcy@wavefire.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

This should be on the otyher lists, novice or general for example but here is
your answer anyway.

SELECT item, location FROM foo GROUP BY item,location HAVING count(item) >1
AND count(location) > 1;

On Wednesday 06 August 2003 12:05, The Pennant Shop 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.
>
> Thanks a lot / Alex
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend

--
Darcy Buskermolen
Wavefire Technologies Corp.
ph: 250.717.0200
fx: 250.763.1759
http://www.wavefire.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruno Wolff III 2003-08-06 19:25:48 Re: Select distinct question ... complicated
Previous Message John Liu 2003-08-06 19:11:18 Re: Select distinct question ... complicated