try:select count(0) FROM (SELECT [id], title FROM news WHERE news_type='1')aselect * from 
(select rownum as [count],a.* from (SELECT [id], title FROM news WHERE news_type='1' )a ) b
where b.[count]>0 and b.[count]<=10

解决方案 »

  1.   

    select count(*) FROM (SELECT id, title FROM news WHERE news_type='1') a  --加上别名select * from (select rownum as [count] --count是保留关键字,加上[]
    ,a.* from (SELECT id, title FROM news WHERE news_type='1' ) a)a --加上别名
     where [count]>0 and [count]<=10 --count是保留关键字,加上[]
      

  2.   

    select count(*) FROM (SELECT id, title FROM news WHERE news_type='1') aselect * from (select rownum as count,a.* from (SELECT id, title FROM news WHERE news_type='1' ) a) b where count>0 and count<=10
      

  3.   

    rownum在sqlserver里好像无效呀?? 有没有什么替换它的?
      

  4.   

    select @count=count(*) from tablename