| От | Rob Sargent |
|---|---|
| Тема | Re: get first and last row in one sql as two columns |
| Дата | |
| Msg-id | 55E785D1.7030300@gmail.com обсуждение исходный текст |
| Ответ на | get first and last row in one sql as two columns (Tom Smith <tomsmith1989sk@gmail.com>) |
| Ответы |
Re: get first and last row in one sql as two columns
|
| Список | pgsql-general |
If you're ordering by col1, doesThanksfunctions as it has many use casesI am wondering why these two functions are not part of postgresql built-into do this. Is it widely used and reliable?I saw some posting in wiki with a custom function (or C extention)select first(col1), last(col1) from table order by col1Hi:I need to get the first and last tow in one sql like below
https://wiki.postgresql.org/wiki/First/last_(aggregate)
select min(col1), max(col1) from table order by col1not do the trick;
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера