| От | Tom Lane |
|---|---|
| Тема | Re: How to select and result row number?? |
| Дата | |
| Msg-id | 8957.1032300796@sss.pgh.pa.us обсуждение |
| Ответ на | Re: How to select and result row number?? (Bruce Momjian <pgman@candle.pha.pa.us>) |
| Ответы |
Re: How to select and result row number??
|
| Список | pgsql-sql |
Bruce Momjian <pgman@candle.pha.pa.us> writes:
>>> select nextval('temp_counter'), * from (select .... order by ...);
>>
>> Approximately the same solution, but without saving the result in a temp
>> table.
> I thought about doing it this way. However, a subselect as a
> pseudotable is not guaranteed to return the data in any specific order,
> so I don't think this method work work reliably.
Say what? Given the ORDER BY in the subselect, it will.
Of course, you can't do any grouping or other processing at the outer
level, but the example as given is just fine.
regards, tom lane
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера