pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Frank Bax <fbax@execulink.com>
To: pgsql-sql@postgresql.org
Subject: Re: [Fwd: Re: no ORDER BY in subselects?]
Date: Thu, 21 Sep 2000 11:50:10 -0400
Message-ID: <3.0.6.32.20000921115010.0097e1b0@execulink.com> (raw)
In-Reply-To: <3.0.5.32.20000921112954.00c9be00@mail.rhyme.com.au>
References: <39C8E3C9.D1CFFDB3@agliodbs.com>

At 11:29 AM 9/21/00 +1000, you wrote:
>The main reason I use them is to find the 'next' or 'previous' record in a
>list (eg. next date, next ID). eg.
>
>  select <whatever>, (select ID from table where id > this.id 
>  order by id asc limit 1) as next_id ...

Doesn't this give the same result (without order by):

>  select <whatever>, (select min(ID) from table where id > this.id) as
next_id

Frank




view thread (6+ messages)  latest in thread

Message-ID: <3.0.6.32.20000921115010.0097e1b0@execulink.com>
Permalink:  ../3.0.6.32.20000921115010.0097e1b0@execulink.com/
Also on:    postgresql.org/message-id/3.0.6.32.20000921115010.0097e1b0@execulink.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: fbax@execulink.com
  Subject: Re: [Fwd: Re: no ORDER BY in subselects?]
  In-Reply-To: <3.0.6.32.20000921115010.0097e1b0@execulink.com>
  References: <39C8E3C9.D1CFFDB3@agliodbs.com> <3.0.6.32.20000921115010.0097e1b0@execulink.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