Re: How to realize ROW_NUMBER() in 8.3?

Поиск
Список
Период
Сортировка
От Andreas Kretschmer
Тема Re: How to realize ROW_NUMBER() in 8.3?
Дата
Msg-id 20110504052836.GA5658@tux
обсуждение исходный текст
Ответ на Re: How to realize ROW_NUMBER() in 8.3?  (Emi Lu <emilu@encs.concordia.ca>)
Список pgsql-sql
Emi Lu <emilu@encs.concordia.ca> wrote:

> Thank you for the info.
>
> I found a simple way:
> ==========================
> [1] create SEQUENCE tmp start 7820;
> [2]
>     insert into desti_table_name
>     select nextval('tmp'),
>            c1, c2... ... cN
>     from t1 left join t2... ... tn
>     where ... ...
>
> Just for people using 8.3, this is mimic row_number.

Not really... you have to reset the sequence after the select, and i'm
not sure about ordering the result.


Andreas
-- 
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°


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

Предыдущее
От: Viktor Bojović
Дата:
Сообщение: function timeout
Следующее
От: Tarlika Elisabeth Schmitz
Дата:
Сообщение: data import via COPY, Rules + Triggers