mysql order by numbering

simuruk wiki
SELECT 
    @rownum:=@rownum + 1 AS RNUM
    , a.*
FROM
    some_table AS a,
    (SELECT @rownum:=0) AS R
WHERE
    a.some_column = 1
ORDER BY 1;
  • 정렬과 row의 줄수가 몇번째인지 표시