sql questions

Поиск
Список
Период
Сортировка
От hamann.w@t-online.de
Тема sql questions
Дата
Msg-id wolfgang-1180720102638.A0132395@noten19.local
обсуждение исходный текст
Ответы Re: sql questions  (Laurenz Albe <laurenz.albe@cybertec.at>)
Re: sql questions  (Thiemo Kellner <thiemo@gelassene-pferde.biz>)
Re: sql questions  (Brian Dunavant <brian@omniti.com>)
Список pgsql-general

Hi,

a) I am running some select query
select ... order by ....
Now, I would like to preserver the ordering through further processing by adding a sequence number
Of course I can do:
create temp sequence mseq;
select xx.*, nextval('mseq') as ord from (select ... order by ....) xx;
drop sequence mseq;
Is there a simpler way (avoiding the create/drop parts)

b) can a sql function return the count of affected rows of some query?
create function merge_names(int, int) returns void as
$_$
update namelinks set nid = $2 where nid = $1;
-- want the affected rows of the above query
delete from names where nid = $1
-- return result here
$_$
language sql;

Best regards
Wolfgang Hamann



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

Предыдущее
От: Tim Cross
Дата:
Сообщение: Re: User documentation vs Official Docs
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: sql questions