在SQL SERVER中获取表中的第二条数据

在SQL SERVER中获取表中的第二条数据,

思路:先根据时间逆排序取出前2条数据作为一个临时表,再按顺时排序在临时表中取出第一条数据

sql语句如下:
select top 1 * from
(select top 2 * from NumberLog where
UserName = '管理员' order by dateTime desc ) [table] order by dateTime asc

原文地址:https://www.cnblogs.com/Zbuxu/p/6164194.html