标题: 各种数据库中取得前N条记录的写法都是什么? [打印本页] 作者: 邢城 时间: 2013-7-2 11:26 标题: 各种数据库中取得前N条记录的写法都是什么? 作者: 淡写轻描 时间: 2013-7-2 11:29
1. ORACLE SELECT * FROM TABLE1 WHERE ROWNUM<=N 2. INFORMIX SELECT FIRST N * FROM TABLE1 3. DB2 SELECT * ROW_NUMBER() OVER(ORDER BY COL1DESC) AS ROWNUM WHERE ROWNUM<=N 或者SELECT COLUMN FROM TABLE FETCH FIRST N ROWSONLY 4. SQL SERVER (ACCESS)SELECT TOP N * FROM TABLE1 5. SYBASE SET ROWCOUNT N GO SELECT * FROM TABLE1 6. MYSQL SELECT * FROM TABLE1 LIMIT N 7. FOXPRO SELECT * TOP N FROM TABLE ORDER BY COLUMN