1.SQL SERVER 是用先逆序再正序的方法
select top 3 * from (select top 9 * from mvc_book order by bid) as s order by s.bid desc [第6,5,4條]
select * from (select top 3 * from (select top 6 * from mvc_book order by bid) as s order by s.bid desc) as s1 order by s1.bid [第4,5,6條]
select top 6 * from mvc_book where (bid not in (select top 2 bid from mvc_book))[第3,4,5,6,7,8條]
2.ORACLE 用Minus和Rownum來實(shí)現(xiàn) (Minus 減去 Union 聯(lián)合 Intersect 返回相同的記錄集)
select * from t_service_vnet_send where rownum <= 15 MINUS select * from t_service_vnet_send where rownum <= 10;
或
select * from (select rownum no,id,age,name from loaddata where rownum <= 3 ) where no >= 2;
3.DB2
select * from (select ROW_NUMBER() over() as a, org.* from org) as temp where a>=n1 and a<=n2
4.MYSQL
select * from tablename limit m,n;
posted on 2009-01-30 20:36
cheng 閱讀(1297)
評(píng)論(0) 編輯 收藏 所屬分類:
SQLServer 、
Oracle