直接上例子:

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


得到结果如下:


Logo

更多推荐