Re: [PHP] 'SERIAL' in pgsql - 07-16-2012 , 04:56 AM
On 16 July 2012 10:23, Archana K N <archanakknn (AT) gmail (DOT) com> wrote:
"make this column using type INTEGER, make a new sequence that will be
owned by this column and set this column's default value to get the
next value from that sequence".
If you really want the row's position within the result set, you can
use a window function, like:
SELECT row_number() OVER (ORDER BY primary_key_column_name ASC), *
ORDER BY primary_key_column_name ASC;
Or you may wish to push the main query into a subquery and get a
row_number out of that so that you don't have to duplicate the ORDER
SELECT row_number() OVER (), x.*
ORDER BY primary_key_column_name ASC
for more info.
Sent via pgsql-php mailing list (pgsql-php (AT) postgresql (DOT) org)
To make changes to your subscription: