select top 5 * from (select top 10 * from table_name order by id desc)

解决方案 »

  1.   

    select top 5 a.* from 
    (select top 10 * from table_name order by 排序 desc) a

    select top 10 id int IDENTITY (1, 1) NOT NULL , * into #a from table_name 
    select * from #a where id>=5 
    drop tabel #a
      

  2.   

    select top 5 * from (select top 10 * from table_name order by id desc)
      

  3.   

    select top 5 * from (select top 10 * from table_name order by id desc)
    这条语句我在执行的时候出现错误信息-
    ‘)’附近有语法错误 我看了 语句没有任何错误
    另外我才明白这个语句的含义是之后倒排序取前5条,
    这对于数据库来说是一个不现实的问题 有10000条记录啊