Could you help me with the problem below?
I have created a SET table with two columns: user VARCHAR(12) and prob FLOAT.
I would like to acquire 3000000 user with bigger prob.
So, I do like this:
SELECT (ROW_NUMBER() OVER (ORDER BY prob DESC) ) AS prob_rank,
If there are equal Prob values, there is no determinism about what order the users will sort. If you need the same rownumber for the same user, you may have to ORDER BY both prob and user.
Also note that you can use the QUALIFY clause in the first select rather than having to store the result of the whole set with rownumber and then run the second select to get the subset you wish.