一条简单的SQL语句..怎么设置从某一行开始查询
比如
我有一个方法 List queryBy(int count,int start){
String sql;
.....
}
这个sql应该怎么写呀! start就是要开始查询的那一行!
比如
我有一个方法 List queryBy(int count,int start){
String sql;
.....
}
这个sql应该怎么写呀! start就是要开始查询的那一行!
--第11条到第20条,共选出10条记录
select *
from (select top 10 * from (select top 20 * from 表名 order by ID) t1 order by ID desc) t2
order by ID
--方法2
--第11条到第20条,共选出10条记录
select top 10 *
from 表名
where ID>(select max(ID) from (select top 10 ID from 表名 order by ID) t1)
order by ID
--方法3
--增加自动编号列
select *
from 表
where id between 11 and 20
有没有 直接查询 第5行到第10行信息的方法!急!非常感谢!