My colleague made an sql query where he uses Rownum to sort the selection with, now his query is setup like the following:
The thing that is happening in this code is that a subtable is selected with a rownum in it's result so it can be sorted on it. But the odd thing is when the final order by in the where clause is left out the sorting is in a random order
if the orber by RowNum is there it orders on that result as normal.
Code:
Select *,RowNum
From
(select rownum() over(id) from test) as RowNum
where
--
order by RowNum
The thing that is happening in this code is that a subtable is selected with a rownum in it's result so it can be sorted on it. But the odd thing is when the final order by in the where clause is left out the sorting is in a random order
if the orber by RowNum is there it orders on that result as normal.