如在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條記錄
資料庫 讀取前幾條資料
1.oracle資料庫 select from tablename where rownum n 2.infomix資料庫 select first n from tablename 3.db2資料庫 select from select row number over as rownum from...
sql在不同資料庫查詢前幾條資料
sql在不同資料庫查詢前幾條資料 1.oracle select from table1 where rownum n hql from table1 t order by t.createtime desc where rownum n 2.informix select first n from...
sql在不同資料庫查詢前幾條資料
sql在不同資料庫查詢前幾條資料 1.oracle select from table1 where rownum n hql from table1 t order by t.createtime desc where rownum n 2.informix select first n from...