Skip to content
Advertisement

SQL query for column numbers

I have a table with information like :

enter image description here

With these 2 columns I need to pull a column like “New Column” which is basically serial numbers of pages for each order.

I tried ROW_NUMBER() OVER(ORDER BY Page) AS NewColumn

But that serialized the whole column and did not consider OrderNumber.

Advertisement

Answer

You miss the partition

OVER(PARTITION BY OrderNumber ORDER BY Page)
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement