我要列出一个表中的最新10条数据中倒数7条,怎么写?
基本语句如下:select top 10 article_id,subject title,utime adddate,doc_type,title_color from newstitle where pub_status='1' and doc_type=2 order by utime desc

解决方案 »

  1.   

    select top 7 article_id,subject title,utime adddate,doc_type,title_color from 
    (select top 10 article_id,subject title,utime adddate,doc_type,title_color from newstitle where pub_status='1' and doc_type=2 order by utime desc) a order by a.utime
      

  2.   

    select top 7 * from 
    (select top 10 article_id,subject title,utime adddate,doc_type,title_color from newstitle where pub_status='1' and doc_type=2 order by utime desc) a
    order by utime
      

  3.   

    谢谢,我试了但出会提示错误..
    原句是这样的,strsql="select * from(select source article_id,subject title,utime adddate,doc_type,title_color from newstitle where pub_status='1' and doc_type='外汇新闻' order by utime desc) where rownum<11"我现在要最新的倒数7条! 怎么办?
      

  4.   

    select top 7 * from 
    (
    select top 10 * from newstitle
    order by time
    ) order by 时间 desc
      

  5.   

    select top 7 article_id,subject title,utime adddate,doc_type,title_color from 
    (select top 10 article_id,subject,utime,doc_type,title_color from newstitle where pub_status='1' and doc_type=2 order by utime desc) a order by a.utime