日期:2014-05-18  浏览次数:20452 次

一条简单的sql查询语句,送分了
查询一个按时间排序的表

只要查询出第三条开始的数据,也就是除了前两条的数据

------解决方案--------------------
select * from T where ID not in (select top 2 ID from T)
------解决方案--------------------
//先排序再从第三条开始取
select * from T where ID not in (select top 2 ID from T order By Time desc|asc)

//先按默认排序再从第三条开始取
select * from T where ID not in (select top 2 ID from T) order By time desc|asc
------解决方案--------------------
SELECT [HolidayDate]
FROM [tblHoliday] where [HolidayDate] not in (select top 2 [HolidayDate] from [tblHoliday] order by HolidayDate desc) order by HolidayDate desc