ROW_NUMBER()
MySQL Function: ROW_NUMBER()
Categories:
Support
MySQL does not support the ROW_NUMBER() function before version 8.0
, but they provide a session variable that allows us to emulate this function.
MySQL ROW_NUMBER() Using Session Variable
SET @row_number = 0;
SELECT *
(@row_number:=@row_number + 1) AS row_num
FROM user
ORDER BY created_at;