I have an ORDER BY clause based on values from my RANDOM() statement. Is there a way to display the whole number (i.e. integers starting at 1) sequencing of these RANDOM() values in order based on the ORDER BY clause?
Here is a super simplified query illustrating the basics of what I’m trying to accomplish:
SELECT sub.random, (INTEGER_STARTING_WITH_ONE()) as integer
FROM (SELECT (RANDOM()) as random
ORDER BY random) sub
ORDER BY integer
and here is a visual of what I’m looking to kick out of my query:
1 lowest RANDOM() value
2 second lowest RANDOM() value
3 third lowest RANDOM() value
4 fourth lowest RANDOM() value
5 fifth lowest RANDOM() value
(etc. with no # cap until all data delivered)
(Note: I do not have the option of creating an INDEX to help with this query)
Thank you all for helping me brainstorm!