如题:下边是我的分页查询
select top 10 * from table
where id not in ( 
select top 10 * ( pageNo - 1 ) id from table)
总是报错:
消息 170,级别 15,状态 1,第 3 行
第 3 行: '(' 附近有语法错误。
请大家帮忙分析一下哪里错了,难道sqlserver分页不是这样写的么?

解决方案 »

  1.   

    where id not in (  
    select top 10 * ( pageNo - 1 ) id from table)
    兄弟,这个地方错啦,id not in 里面的子查询只能是一个字段,你里面写的select top 10 * ( pageNo - 1 ) id from table,多了个星号*,去掉就好了
     
      

  2.   

    我知道是怎么回事了,10*(pageNo-1)是一个整体,在java中可以这样拼接sql,但是不能直接拿到数据库中执行