How can I count the row number in the returned gro

2020-08-01 05:47发布

问题:

How can I get the row number in the returned mysql query? Let say, if my query is returning some 5 rows as a result, I want to know that row is 1st,2nd, 3rd etc.

回答1:

SELECT @row := @row + 1 as row, t.*
FROM some_table t, (SELECT @row := 0) r


标签: mysql