| От | Tom Lane |
|---|---|
| Тема | Re: How to select the last value/row? |
| Дата | |
| Msg-id | 1218123.1688659921@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: How to select the last value/row? (Shaozhong SHI <shishaozhong@gmail.com>) |
| Список | pgsql-sql |
Shaozhong SHI <shishaozhong@gmail.com> writes:
> How about
> ID
> 5
> 4
> 3
> 3
> 2
> 3
> The last is 3.
You need to reorient your thinking. In SQL, row sets are unordered sets
of values --- this is not a Postgres deficiency, it's a fundamental tenet
of the relational data model. If you want some kind of ordering, you have
to express that by an ORDER BY clause, which means you need something
within the data that corresponds to what you want the ordering to be.
Your example above is basically nonsense from the standpoint of SQL.
regards, tom lane
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера