按照时间自动编号
select * from tb where ...
结果如下:
time num
9:01 23
9:02 1.2
9:03 112
9:04 3
... ..
希望得到如下结果:
id time num
1 9:01 23
2 9:02 1.2
3 9:03 112
4 9:04 3
5 ... ..
不用临时表.
------解决方案--------------------select *,(select count(*) from tb where a.time> =time ) from tb a where
------解决方案-------------------- select (select count(1) from tb b where a.time> =b.time) as ID, * from tb a