Re: Grouping Too Closely

From: "Greg Sabino Mullane" <greg(at)turnstep(dot)com>
To: tfo(at)sitening(dot)com
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Grouping Too Closely
Date: 2005-06-25 06:40:21
Message-ID: a053b85772b71eaf158e0354551e72d2@biglumber.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> 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.

Then perhaps just:

SELECT fkey, seq2, min(seq1)
FROM my_table
WHERE seq2 > 2
GROUP BY fkey, seq2
ORDER BY 1,2,3;

- --
Greg Sabino Mullane greg(at)turnstep(dot)com
PGP Key: 0x14964AC8 200506250237
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8

-----BEGIN PGP SIGNATURE-----

iD8DBQFCvPwJvJuQZxSWSsgRAtcHAKDzl67Va8ABP4qyNpvFtWDpjmT/iwCg3D5J
kJMkDaELNZREh5+7OyJ/FSU=
=SChT
-----END PGP SIGNATURE-----

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jan Wieck 2005-06-25 14:00:53 Re: people who buy A, also buy C, D, E
Previous Message Thomas F. O'Connell 2005-06-25 05:32:45 Re: Grouping Too Closely