X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3D60A52896 for ; Sat, 25 Jun 2005 01:23:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14900-04 for ; Sat, 25 Jun 2005 04:22:55 +0000 (GMT) Received: from biglumber.com (biglumber.com [207.228.252.42]) by svr1.postgresql.org (Postfix) with SMTP id 04E6A52835 for ; Sat, 25 Jun 2005 01:22:54 -0300 (ADT) Received: (qmail 711 invoked from network); 25 Jun 2005 04:22:54 -0000 Received: from unknown (HELO localhost) (207.228.252.42) by 0 with SMTP; 25 Jun 2005 04:22:54 -0000 From: "Greg Sabino Mullane" To: pgsql-sql@postgresql.org Cc: tfo@sitening.com Cc: tfo@sitening.com Subject: Re: Grouping Too Closely X-PGP-Key: 2529 DF6A B8F7 9407 E944 45B4 BC9B 9067 1496 4AC8 X-Request-PGP: http://www.biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 In-Reply-To: Date: Sat, 25 Jun 2005 04:22:54 -0000 X-Mailer: JoyMail 1.48 Message-ID: <7fdee0e68098da02600bf51be5a7f3f5@biglumber.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.22 tagged_above=0 required=5 tests=AWL, UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200506/297 X-Sequence-Number: 21898 -----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-----