(select top 2 * from table) a,(select top 1 * from table) b where a.字段!=b.字段(找个肯定不同的字段)
oracle :select * from (select t.*,rownum as num from table where rownum<=2) where num=2
SELECT TOP 2 * FROM 表
EXCEPT
SELECT TOP 1 * FROM 表;
SQL Server 下面可以这么写。
其他数据库不行。
select * from
(select row_number() over(order by getdate()) as rn,* from tablename) as t
where rn=2