pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: oheinz@stud.fbi.fh-darmstadt.de
To: pgsql-sql@postgresql.org
Subject: Re: Problem using Subselect results
Date: Wed, 30 Jul 2003 11:08:56 -0700
Message-ID: <200307301108.56047.josh@agliodbs.com> (raw)
In-Reply-To: <1059555167.3f27875f7e3da@stud.fbi.fh-darmstadt.de>
References: <1058964708.3f1e84e407a8d@stud.fbi.fh-darmstadt.de>
	<000401c355e4$11b0cdd0$0f02a8c0@spineofgod>
	<1059555167.3f27875f7e3da@stud.fbi.fh-darmstadt.de>

Oliver,

> SELECT DISTINCT ON (two.two_id) two.two_value FROM one,two WHERE 
> (one.two_id=two.two_id 
> AND one.updatenr > two.updatenr) ORDER BY two.updatenr ASC;

FWIW, SELECT DISTINCT ON () is slower than SELECT .... ORDER BY ... LIMIT 1 on 
all stable versions of Postgres.   Not that the LIMIT 1 method can be used 
with all queries.

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco




view thread (15+ messages)

Message-ID: <200307301108.56047.josh@agliodbs.com>
Permalink:  ../200307301108.56047.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200307301108.56047.josh@agliodbs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com, oheinz@stud.fbi.fh-darmstadt.de
  Subject: Re: Problem using Subselect results
  In-Reply-To: <200307301108.56047.josh@agliodbs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox