I have a select query where I have RowNumber()
function, so I have row number by a partition in the result.
What do I want to achieve? I want to update all row numbers of each partition except the last row of each partition. So suppose we have RowNumber 1,2,3,4
and another partition with 1,2
I want to do an update clause to update all row numbers except number 4
(first partition) and exclude row number 2
of the second partition.
I know we can exclude first row number using a simple condition in where clause like RowNumber != 1
but in this case, I want the last row number of each partition and that number is different in all partitions .
How can I achieve this? Regards