Re: Function for numbering rows?

Поиск
Список
Период
Сортировка
От CoL
Тема Re: Function for numbering rows?
Дата
Msg-id c5f4n0$l4f$1@news.hub.org
обсуждение исходный текст
Список pgsql-sql
hi,

Tony Reina wrote, On 4/10/2004 18:12:

> Simple question:
> 
> Is there a function that will allow me to number the returned tuples?
> 
> e.g. 
> 
> CREATE TABLE test (
> field1 text
> ):
> 
> INSERT INTO test VALUES ('first');
> INSERT INTO test VALUES ('second');
> INSERT INTO test VALUES ('third');
> INSERT INTO test VALUES ('fourth');
> 
> SELECT number(), field1 FROM test;
> 
> 1  'first'
> 2  'second'
> 3  'third'
> 4  'fourth'
> 
> where number() is the function I'm trying to find out about.
a simple way:
create temporary sequence st;
select nextval('st'),field1 from test;
drop sequence st;

C.


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

Предыдущее
От:
Дата:
Сообщение: ANN: www.SQL-Scripts.Com
Следующее
От: Jeff Boes
Дата:
Сообщение: Re: SQL challenge--top 10 for each key value?