Add a line/row number in front of query results

  • Thread starter Thread starter Michael Kintner
  • Start date Start date
M

Michael Kintner

How can a add a line number in front of the returned query results?

Example: If a query returns 3 records:
Dog
Cat
Mouse

I would like to query to return the results with line numbers:
1 Dog
2 Cat
3 Mouse

The query would add line/row numbers for the returned results.

Thank you in advance, I have asked this question in the past but having a
hard time in trying to explain this simple concept or maybe its not so
simple.

Michael Kintner
 
RowNum Sample

SELECT (SELECT COUNT(*)+1 FROM PERMISSIONS P1 WHERE P1.ID < P.ID) AS
ROWNUM, P.*
FROM PERMISSIONS P

HTH

Pieter
 
Back
Top