1 2 3 4 5 6 7 8 9 10 11 12 13
SELECT r.id, ROW_NUMBER() OVER w AS rank FROM ( SELECT 0 AS id ) AS r JOIN ( SELECT 0 AS id ) AS m ON r.id = m.id WINDOW w AS ( PARTITION BY r.id )