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 E4534D1CAF3 for ; Thu, 19 Feb 2004 19:29:51 +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 89152-04 for ; Thu, 19 Feb 2004 15:29:43 -0400 (AST) Received: from davinci.ethosmedia.com (server228.ethosmedia.com [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 42947D1B456 for ; Thu, 19 Feb 2004 15:29:41 -0400 (AST) Received: from [63.195.55.98] (HELO 192.168.1.29) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 4457869; Thu, 19 Feb 2004 11:30:46 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: , Subject: Re: DISTINCT ON troubles Date: Thu, 19 Feb 2004 11:28:51 -0800 User-Agent: KMail/1.5.4 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200402191128.51124.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/285 X-Sequence-Number: 16975 Jeremy, > Am I just approaching this all wrong and need to create a temporary table > and draw from that, or is there a way to salvage this query? Think about using a subquery instead of the DISTINCT ON approach. I don't think you can get what you want with DISTINCT ON. A temporary table is not necessary. -- -Josh Berkus Aglio Database Solutions San Francisco