select top 4 * from (select top 8 from 记录集 order by 排序字段 desc) asc

解决方案 »

  1.   

    select top 4 * from tb where id not in(select top 4 * from tb order by id)
    order by id
      

  2.   

    上面有错误,这个可以
    select top 4 * 
    from (select top 8 from 记录集 order by 排序字段 desc) 
    order by 排序字段 asc
      

  3.   

    SELECT TOP 4 *
    FROM (SELECT TOP 8
            FROM news_table
            WHERE (picchk = 0) AND (shenghe = 1) AND (typeid = 118))
    ORDER BY commend DESC
    报错阿
      

  4.   

    SELECT TOP 4 *
    FROM (SELECT TOP 8
            FROM news_table
            WHERE (picchk = 0) AND (shenghe = 1) AND (typeid = 118) ORDER BY commend desc  ) a
    ORDER BY commend asc
      

  5.   

    SELECT TOP 4 *
    FROM news_table
    WHERE (newsid NOT IN
              (SELECT TOP 4 newsid
             FROM news_table
             WHERE (picchk = 0) AND (shenghe = 1) AND (typeid = 118)
             ORDER BY newsid DESC)) AND (picchk = 0) AND (shenghe = 1) AND (typeid = 118)
    ORDER BY newsid DESC
    这个好像行
      

  6.   

    要求 from 后的查询结果给个别名,起成什么都行
    SELECT TOP 4 *
    FROM (SELECT TOP 8
            FROM news_table
            WHERE (picchk = 0) AND (shenghe = 1) AND (typeid = 118)ORDER BY commend desc )
    a
    ORDER BY commend asc
      

  7.   

    SELECT TOP 4 a.*
    FROM (  SELECT TOP 8 * 
            FROM news_table
            WHERE (picchk = 0) AND (shenghe = 1) AND (typeid = 118) 
            ORDER BY commend desc 
         ) a
    ORDER BY commend asc
      

  8.   

    不好意思8后少个星号
    SELECT TOP 4 *
    FROM (SELECT TOP 8 *
            FROM news_table
            WHERE (picchk = 0) AND (shenghe = 1) AND (typeid = 118)ORDER BY commend desc )
    a
    ORDER BY commend asc
      

  9.   

    SELECT TOP 4 a.*
    FROM (  SELECT TOP 8 * 
            FROM news_table
            WHERE (picchk = 0) AND (shenghe = 1) AND (typeid = 118) 
            ORDER BY commend desc 
         ) a
    ORDER BY a.commend asc