在网上找了一下,结合其他案例总结写了一个。
感觉有性能问题,和不足之处,求大神指点。
SELECT (@rowNum:=@rowNum+1) `行号`,t.* FROM t_test t,(select @rowNum:=0) r ORDER BY `行号` DESC LIMIT 1