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 子句在视图、内嵌函数、派生表和子查询中无效。”

解决方案 »

  1.   

    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
      

  2.   

    这样试试看
    select top 10 id from aa_tb
    where id not in (select top 0 id from aa_tb) 
    order by birthday descorder by 和top 需要在最外层配合似乎,不用把order by放在中间的结果集中配合一般还是在语句最有order by
      

  3.   

    有TOP了还要order by 干什么啊?