SELECT t.*, 
  @RowNum := @RowNum + 1 AS RowNum
FROM t, 
  (SELECT @RowNum := 0) AS myRows

MySQL中没有ROW_NUMBER()函数,可以用以上代码替换。