1. Oracle数据库 SELECT * FROM TABLE1 WHERE ROWNUM<=N 2. Infomix数据库 SELECT FIRST N * FROM TABLE1 3. DB2数据库 SELECT * ROW_NUMBER() OVER(ORDER BY COL1 DESC) AS ROWNUM WHERE ROWNUM<=N 或者 SELECT COLUMN FROM TABLE FETCH FIRST N ROWS ONLY 4. SQL Server数据库 SELE…
--跳过10条取2条 也叫分页select top 2 * from studentwhere studentno not in (select top 2 studentno from student order by studentno)order by studentno --row_number ()over() 分页select * from(select *,ROW_NUMBER()over(order by studentno)as myid from student ) as t…
使用查询语句 select top 1 * from News order by [PublicTime] desc 就不一定管用了,如果News表里面的PublicTime字段没有重复的话,那么OK,结果是正确的,而如果里面有重复的数据,那么有多少条重复的就 会查询出多少条记录. 为什么会这样呢? 引用“JET SQL不是 T-SQL语句,jet sql 会返回重复值,也就是说,一个表中如果 ORDER BY 的字段都是 0 ,一共有100条记录,即使你用SELECT T…