From: Greg Sabino Mullane <greg@turnstep.com>
To: pgsql-sql@postgresql.org
Cc: tfo@sitening.com
Subject: Re: Grouping Too Closely
Date: Sat, 25 Jun 2005 04:22:54 -0000
Message-ID: <7fdee0e68098da02600bf51be5a7f3f5@biglumber.com> (raw)
In-Reply-To: <BBA34C36-E1D7-4166-A47F-BA0D563C48B9@sitening.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> 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;
- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200506250019
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----
iD8DBQFCvNuWvJuQZxSWSsgRAhPZAJ9ssJx1/9x1Ngr9i/fThpKkDwMq1wCg5TW0
fKHUuoUBrXx+0/5hRegpXF4=
=obPq
-----END PGP SIGNATURE-----
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: greg@turnstep.com, tfo@sitening.com
Subject: Re: Grouping Too Closely
In-Reply-To: <7fdee0e68098da02600bf51be5a7f3f5@biglumber.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