Search Postgresql Archives

Re: How to realize ROW_NUMBER() in 8.3?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2011-04-20, Emi Lu wrote:
 
> Hello,
> 
> ROW_NUMBER() is only ready in 8.4. For 8.3, is there a simple
> way to get
> row_number
> 
> select row_number(), col1, col2...
> FROM   tableName
> 

You definitely want to skim through the SQL Cookbook
(http://www.oreilly.de/catalog/9780596009762/) for this and many other
things.

Iirc, it suggested a set of CTEs that were joined together and grew
exponentially to get the sequence of numbers, which where finally joined
to the actual query. Pretty elegant and with tailored solutions for
various RDBMS including Postgres.

-- 
Robert...
 


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux