Re: Grouping Too Closely - Mailing list pgsql-sql

From Thomas F. O'Connell
Subject Re: Grouping Too Closely
Date
Msg-id 62592AAD-20CB-42EC-B599-E1D42D16A7BC@sitening.com
Whole thread Raw
In response to Re: Grouping Too Closely  ("Greg Sabino Mullane" <greg@turnstep.com>)
Responses Re: Grouping Too Closely  ("Greg Sabino Mullane" <greg@turnstep.com>)
List pgsql-sql
This doesn't give me quite what I'm looking for because I need there
to be only one of each possible value of seq2 to be returned for each
value of fkey.

--
Thomas F. O'Connell
Co-Founder, Information Architect
Sitening, LLC

Strategic Open Source: Open Your i™

http://www.sitening.com/
110 30th Avenue North, Suite 6
Nashville, TN 37203-6320
615-260-0005

On Jun 24, 2005, at 11:22 PM, Greg Sabino Mullane wrote:

>> What I'd like to be able to do is select all records corresponding to
>> the minimum value of seq1 for each value of seq2 corresponding to a
>> given fkey (with a lower bound on the value of seq2).
>
> I'm not sure how uid figures in, but would this do what you want?:
>
> SELECT fkey, uid, seq2, min(seq1)
> FROM my_table
> WHERE seq2 > 2
> GROUP BY fkey, uid, seq2
> ORDER BY 1,2,3;


pgsql-sql by date:

Previous
From: "Greg Sabino Mullane"
Date:
Subject: Re: Grouping Too Closely
Next
From: "Greg Sabino Mullane"
Date:
Subject: Re: Grouping Too Closely