在SQL SERVER中获取表中的第二条数据,
思路:先根据时间逆排序取出前2条数据作为一个临时表,再按顺时排序在临时表中取出第一条数据
sql语句如下:
select top 1 * from
(select top 2 * from NumberLog where
UserName = '管理员' order by dateTime desc ) [table] order by dateTime asc
在SQL SERVER中获取表中的第二条数据,
思路:先根据时间逆排序取出前2条数据作为一个临时表,再按顺时排序在临时表中取出第一条数据
sql语句如下:
select top 1 * from
(select top 2 * from NumberLog where
UserName = '管理员' order by dateTime desc ) [table] order by dateTime asc
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。