Skip to content
Advertisement

How to show row numbers in PostgreSQL query?

I’d like to show the observation number for each record returned by a PostgreSQL query.

I think in 8.4 windowing functions can perform this capability.

Advertisement

Answer

If order is not necessary, this answer may also be simplified:


SQL Fiddle Proof of Concept

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement