Re: [Fwd: Re: no ORDER BY in subselects?] - Mailing list pgsql-sql

From Frank Bax
Subject Re: [Fwd: Re: no ORDER BY in subselects?]
Date
Msg-id 3.0.6.32.20000921115010.0097e1b0@execulink.com
Whole thread Raw
In response to Re: [Fwd: Re: no ORDER BY in subselects?]  (Philip Warner <pjw@rhyme.com.au>)
Responses Re: [Fwd: Re: no ORDER BY in subselects?]  (Philip Warner <pjw@rhyme.com.au>)
List pgsql-sql
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



pgsql-sql by date:

Previous
From: Sergio de Almeida Lenzi
Date:
Subject: Re: sql query not using indexes
Next
From: "Brian C. Doyle"
Date:
Subject: Multiple Index's