1
votes

How can i generate a select query in a way that i can select 5 columns and assign a unique row # for each of those rows. e.g. I have a table A as Col1, Col2, Col3, Col4

Desired OUTPUT from Query: row_id, Col1, Col2, col3, col4

where row_id ranges from 1 till total # of rows.

1

1 Answers

1
votes

you can use the row_number function.

select (row_number() over()), Col1, Col2, col3, col4 from table_name