SQL 内联子查询

来源:互联网 发布:软件项目经理常用工具 编辑:程序博客网 时间:2024/05/19 16:33

我们在使用内联子查询时,有时会出现错误提示“在关键字order 处有错误 ”,如下例:

select * from (select top(num) * from table1 order by id asc) order by id desc;

正确的应该是:

select * from (select top(num) * from table1 order by id asc) order by id desc;

注意子查询语句中一定要使用top(num)