X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 37087D1B54B for ; Wed, 15 Oct 2003 14:49:19 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 64777-10 for ; Wed, 15 Oct 2003 11:48:52 -0300 (ADT) Received: from biglumber.com (biglumber.com [207.228.252.42]) by svr1.postgresql.org (Postfix) with SMTP id B483ED1B544 for ; Wed, 15 Oct 2003 11:48:47 -0300 (ADT) Received: (qmail 3842 invoked from network); 15 Oct 2003 14:48:37 -0000 Received: from unknown (HELO localhost) (207.228.252.42) by 0 with SMTP; 15 Oct 2003 14:48:37 -0000 From: greg@turnstep.com To: pgsql-sql@postgresql.org Cc: aicean@netspeed-tech.com Cc: aicean@netspeed-tech.com Subject: Re: How can I produce the following desired result? 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: <017c01c392c8$baf24560$9e00a8c0@aicean> Date: Wed, 15 Oct 2003 14:48:37 -0000 X-Mailer: JoyMail 1.38 Message-ID: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/174 X-Sequence-Number: 15574 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > How can I produce the following desired result? SELECT * FROM mytable JOIN (SELECT goodid, MAX(storehistoryid) AS storehistoryid FROM mytable GROUP by 1) AS a USING (goodid,storehistoryid); - -- Greg Sabino Mullane greg@turnstep.com PGP Key: 0x14964AC8 200310151046 -----BEGIN PGP SIGNATURE----- Comment: http://www.turnstep.com/pgp.html iD8DBQE/jV4PvJuQZxSWSsgRAmYlAJwL06D+VNkmAT7RDcjXPgGu9oPXkgCgx1SJ OASzEJlWv6qi05xXhPH1NBY= =szda -----END PGP SIGNATURE-----