From: | "Thomas F(dot) O'Connell" <tfo(at)sitening(dot)com> |
---|---|
To: | "Greg Sabino Mullane" <greg(at)turnstep(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Grouping Too Closely |
Date: | 2005-06-25 05:32:45 |
Message-ID: | 62592AAD-20CB-42EC-B599-E1D42D16A7BC@sitening.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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;
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Sabino Mullane | 2005-06-25 06:40:21 | Re: Grouping Too Closely |
Previous Message | Greg Sabino Mullane | 2005-06-25 04:22:54 | Re: Grouping Too Closely |