Written by

Question Caio Timm · Feb 1, 2023

NEED NUMBER ROWS IN SQL SELECT

Hi guys,

I'm trying find a way to create a row with the number of each row.

For example:

In the SQL above, i want a way to create a collum with the number of corresponding row, in this case:

1

2

3

In SQl SERVER i can use FOR, RANK or ROM_NUMBER to do this, but, i can't find a way to do the same in cache SQL.

Can someone help me?

Thank you.

Product version: Caché 2018.1

Comments

Rizmaan Marikar · Feb 7, 2023

Hi @Caio Timm,

You can do something similar to this
SELECT ROW_NUMBER() OVER (ORDER BY <column_name>) AS RowNumber, <other_columns> FROM <table_name>
Eg:

0