mySql 为查询的结果集增加一个序号字段

直接上例子:

select a.*,(@i := @i + 1) as ord_num from t_punch_cade a,(select @i := 0) b order by user_id,punch_time;


得到结果如下:


猜你喜欢

转载自blog.csdn.net/tangpengh/article/details/53171209