Re: How to select the last value/row?

Поиск
Список
Период
Сортировка
От Shaozhong SHI
Тема Re: How to select the last value/row?
Дата
Msg-id CA+i5Jwb2qqUKnPvVHwA8W6HG7AZdCFgu4BajrJpivaTSSxyXqQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: How to select the last value/row?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: How to select the last value/row?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: How to select the last value/row?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql


On Thu, 6 Jul 2023 at 16:51, David G. Johnston <david.g.johnston@gmail.com> wrote:
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.


How about 
ID
5
4
3
3
2
3

The last is 3.

Regards,

David 

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

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