日期:2014-05-18  浏览次数:20475 次

求SQL(用于翻页查询)
已知SQL:select   *   from   Table1;   和两个参数:m(起始行数),n(结束行数)。
想合成一条SQL,实现从表Table1中查询出从第m行到第n行的数据。

谢谢

------解决方案--------------------
select IDENTITY(int,1,1) c1 ,* into #lsb from Table1

select * from #lsb where c1 > = m and c1 <=n
------解决方案--------------------

--設表有ID字段
select * from Table1 as tmp
where (select count(*) from Table1 where id <tmp.id) between m and n