a counter in a select statement

  • Thread starter Thread starter SQLGuy
  • Start date Start date
S

SQLGuy

How do I get a counter in a select statement output

Say if I do
Select counter, col1, col2 from table1

The output should be

Counter Col1 Col2
1 val11 val21
2 val12 val22
3 val13 val23
4 val14 val24
 
Hi guy,

This is a possibility:

select count(*) recnum, a.naam, a.voornaam
from persoon a
inner join persoon b
on a.p_persoon >= b.p_persoon
GROUP BY a.naam, a.voornaam
ORDER BY recnum

Greetz,

Karel
 
Back
Top