How can I count the row number in the returned group of mysql query?
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.
SELECT @row := @row + 1 as row, t.*
FROM some_table t, (SELECT @row := 0) r
精彩评论