读书人

top有关问题

发布时间: 2012-03-22 17:43:57 作者: rapoo

top问题
select top 10 id from ( select * from aa_tb order by birthday desc ) as a where id not in (select top 0 id from aa_tb)

提示“除非同时指定了 TOP,否则 ORDER BY 子句在视图、内嵌函数、派生表和子查询中无效。”

[解决办法]
select top 10 id from aa_tb a where id not in (select top 0 id from aa_tb order by birthday desc ) order by birthday desc

读书人网 >SQL Server

热点推荐