表名=数据表,列名=ID,名称,余额,消费,时间
1 A 13.5 3 2016-6-2 1:37:10
2 B 10.5 2 2016-6-2 2:47:10
3 B 10.5 2 2016-6-2 2:47:15
4 C 8.5 4 2016-6-2 3:47:10
5 B 10.5 2 2016-6-2 8:23:10
6 E 2.5 2 2016-6-2 17:47:10
事先ID、余额、消费、时间都是未知的
我想要的结果:名称为B的最后一次操作记录(第5行)
select * from (select * from table where ID = 'B' order by 时间 desc)m limit 1
谢谢, ID = 'B' ,这个不对吧,B是名称字段,ID是数字=12345,事先ID、余额、消费、时间都是未知的
select * from (select * from table where 名称 = 'B' order by 时间 desc)m limit 1
select*from table where 名称='B' order by 时间 desc rownum=1
cindy_hua : select*from table where 名称='B' order by 时间 desc rownum=1
消息 102,级别 15,状态 1,第 2 行
“rownum”附近有语法错误。
我用的是C#环境