当前位置: 代码迷 >> Java Web开发 >> 求一条sql话语?
  详细解决方案

求一条sql话语?

热度:8449   发布时间:2013-02-25 21:13:59.0
求一条sql语句??
在mysql里面的sql语句是这样的,但是在sqlserver2008里面没有limit这个关键字

String sql = "select * from stu where 1 = 1 ";
sql += " order by stu limit "+((pageIndex-1)*pageSize)+","+pageSize+"";

求在sqlserver里面这条sql语句改怎么写

------解决方案--------------------------------------------------------
String sql = "select top '"+pageSize+"' from stu where id not in(select top '"+pageSize*(pageIndex-1)+" from stu')";
------解决方案--------------------------------------------------------
"select top "+每页显示数+" * from table as t1 where (ID not in (select top "+当前页数+" t2.任务序号 from table as t2 order by ID desc))order by ID desc";

------解决方案--------------------------------------------------------
String sql = "select top "+pageSize+" * from stu where id not in(select top "+pageSize*(pageIndex-1)+" id from stu)";
  相关解决方案