Re: How to select the last value/row?

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: How to select the last value/row?
Дата
Msg-id CAKFQuwaS8FX+r3uBpjmS_6EcnOHKbi33thrOBQW_Zd9RLA6nOw@mail.gmail.com
обсуждение исходный текст
Ответ на How to select the last value/row?  (Shaozhong SHI <shishaozhong@gmail.com>)
Ответы Re: How to select the last value/row?  (Shaozhong SHI <shishaozhong@gmail.com>)
Список pgsql-sql
On Thu, Jul 6, 2023 at 8:47 AM Shaozhong SHI <shishaozhong@gmail.com> wrote:
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?

ORDER BY ASC so the "last item" appears first, then "LIMIT 1"

David J.

В списке pgsql-sql по дате отправления:

Предыдущее
От: Shaozhong SHI
Дата:
Сообщение: How to select the last value/row?
Следующее
От: Shaozhong SHI
Дата:
Сообщение: Re: How to select the last value/row?