Re: [Fwd: Re: no ORDER BY in subselects?]

From: Frank Bax <fbax(at)execulink(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: [Fwd: Re: no ORDER BY in subselects?]
Date: 2000-09-21 15:50:10
Message-ID: 3.0.6.32.20000921115010.0097e1b0@execulink.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Indraneel Majumdar 2000-09-21 16:29:34 How do I run a search on array
Previous Message Sergio de Almeida Lenzi 2000-09-21 12:15:23 Re: sql query not using indexes