[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-sql
Subject:    Re: [SQL] Autoincrement value in a SELECT statement
From:       Tom Lane <tgl () sss ! pgh ! pa ! us>
Date:       2016-08-21 0:09:56
Message-ID: 9677.1471738196 () sss ! pgh ! pa ! us
[Download RAW message or body]

JORGE MALDONADO <jorgemal1960@gmail.com> writes:
> Is it possible to include a field in the SELECT statement which "kind of
> autoincrements" so I can get the position?

The row_number() window function should do that for you, or you might
want rank() depending on what you think should happen for ties.

			regards, tom lane


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic