如在ms sqlserver 用此语句:
select top 2 * from test01 就会只显示前2条记录,
MYSQL
select * from your_table where .... limit 2;
使用limit就可以了.
Oracle的语句:
select * from (select rownum r ,* from test) tt
where tt.r > 50 and tt.r <= 100; (最好用PLSQL游标来解决)
DB2中:
select * from payment fetch first 5 row only --查前5条记录
DB2中查找出第n行到第m行的数据记录
Select *
from (select 列名1 , 列名2 , row_number() over() as a from 表名) as 表别名
where a>=10 and a<=20;