From: Thomas F. O'Connell <tfo@sitening.com>
To: Greg Sabino Mullane <greg@turnstep.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Grouping Too Closely
Date: Sat, 25 Jun 2005 00:32:45 -0500
Message-ID: <62592AAD-20CB-42EC-B599-E1D42D16A7BC@sitening.com> (raw)
In-Reply-To: <7fdee0e68098da02600bf51be5a7f3f5@biglumber.com>
References: <7fdee0e68098da02600bf51be5a7f3f5@biglumber.com>
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;
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tfo@sitening.com, greg@turnstep.com
Subject: Re: Grouping Too Closely
In-Reply-To: <62592AAD-20CB-42EC-B599-E1D42D16A7BC@sitening.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox