How to select the last value/row?

From: Shaozhong SHI <shishaozhong(at)gmail(dot)com>
To: pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: How to select the last value/row?
Date: 2023-07-06 15:46:55
Message-ID: CA+i5JwZj2iCWVok4Bh7E3Z1tWtXrU0ipyPZ0810gkPso7fKRuA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Given,
ID
5
4
3
3
2
1

How to select the last one, to end up with

1

In Python, there are ways to handle ordered list.

In Postgres, is there something similar?

Regards,

David

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message David G. Johnston 2023-07-06 15:51:09 Re: How to select the last value/row?
Previous Message Rob Sargent 2023-07-04 23:28:42 Re: Working around insert into a_table from select things from a_function