Re: How to just get the last in a recursive query

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: Shaozhong SHI <shishaozhong(at)gmail(dot)com>
Cc: "pgsql-sql(at)lists(dot)postgresql(dot)org" <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: Re: How to just get the last in a recursive query
Date: 2022-04-04 23:24:42
Message-ID: 524d8959-47c1-4ea7-92cf-8c946f56b428@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 4/4/22 17:21, Shaozhong SHI wrote:
> That is not the most efficient in this case.
> How to tell query to deliberately miss out all except the last one is
> of interest.
> Regards, David
>
> On Monday, 4 April 2022, Rob Sargent <robjsargent(at)gmail(dot)com> wrote:
>
> On 4/4/22 16:14, Shaozhong SHI wrote:
>>
>>
>> ---------- Forwarded message ---------
>> From: *Shaozhong SHI* <shishaozhong(at)gmail(dot)com>
>> Date: Mon, 4 Apr 2022 at 23:13
>> Subject: How to just get the last in a recursive query
>> To: PostGIS Users Discussion <postgis-users(at)lists(dot)osgeo(dot)org>
>>
>>
>> In this example, Network Walking in PostGIS · Paul Ramsey
>> (cleverelephant.ca)
>> <http://blog.cleverelephant.ca/2010/07/network-walking-in-postgis.html>
>>
>> 3 rows got returns as follows:
>>
>> |id --- 6 3 1|
>> ||
>> |How to just get the last (namely, 1) in the most efficient way?|
>> Regards, David
> reverse the order of the last query and set limit 1
>
Don't top post

And your definition of "last" is what, exactly

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message David G. Johnston 2022-04-04 23:32:12 Re: How to just get the last in a recursive query
Previous Message Shaozhong SHI 2022-04-04 23:21:52 Re: How to just get the last in a recursive query