X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 0D868D1C4EB for ; Wed, 30 Jul 2003 18:10:04 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 77369-05 for ; Wed, 30 Jul 2003 15:09:01 -0300 (ADT) Received: from davinci.ethosmedia.com (209-128-84-228.bayarea.net [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 8BAFFD1C4C9 for ; Wed, 30 Jul 2003 15:10:01 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3361148; Wed, 30 Jul 2003 11:10:22 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: oheinz@stud.fbi.fh-darmstadt.de, pgsql-sql@postgresql.org Subject: Re: Problem using Subselect results Date: Wed, 30 Jul 2003 11:08:56 -0700 User-Agent: KMail/1.4.3 References: <1058964708.3f1e84e407a8d@stud.fbi.fh-darmstadt.de> <000401c355e4$11b0cdd0$0f02a8c0@spineofgod> <1059555167.3f27875f7e3da@stud.fbi.fh-darmstadt.de> In-Reply-To: <1059555167.3f27875f7e3da@stud.fbi.fh-darmstadt.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307301108.56047.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/461 X-Sequence-Number: 14575 Oliver, > SELECT DISTINCT ON (two.two_id) two.two_value FROM one,two WHERE=20 > (one.two_id=3Dtwo.two_id=20 > AND one.updatenr > two.updatenr) ORDER BY two.updatenr ASC; FWIW, SELECT DISTINCT ON () is slower than SELECT .... ORDER BY ... LIMIT 1= on=20 all stable versions of Postgres. Not that the LIMIT 1 method can be used= =20 with all queries. --=20 -Josh Berkus Aglio Database Solutions San Francisco