各種資料庫取前10行記錄 收藏
access:
select top (10) * from table1 where 1=1
db2:
select column from table where 1=1 fetchfirst 10 rows only
取第三行到第5行的記錄
select * from (select row_number() over() as row from table) as temp whererow>=3 and row<=5
mysql:
select * from table1 where 1=1 limit 10
sql server:
讀取前10條:select top (10) * from table1 where 1=1
讀取後10條:select top (10) * from table1 order by id desc
在sqlserver裡面,如何讀取按照某個排序,第5到10這五個記錄
select top 6 * from table where id notin(select top 4 id from table)
oracle:
select * from table1 where rownum<=10
取中間記錄:60~100
select * from (select rownum r,a.* fromtable a where rownum <= 100) where r >= 60;
各種資料庫中,如何讀取前10條記錄
1.oracle select from table1 where rownum n 2.informix select first n from table1 where 1 1 3.db2 select row number over order by col1 desc as rownum w...
各種資料庫取前幾行資料的例子
oracle的sql語句中既不能用limit也不能用top 查第一行資料 select from table where rownum 2 查第二行資料 select from table where rownum 3 minus select from table where rownum 2 查...
各種資料庫查詢前幾條資料
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...