Oracle
在oracle中用ROWNUM
sqlserver
有兩種方式
一種是使用臨時(shí)表,#表名 是臨時(shí)表,##表名 是全局表。
select identity(int,1,1) ROWNUM,TABLE.FIELD1,TABLE.FIELD2,... into #TEMP;
select * from #TEMP where ROWNUM>參數(shù)1 and ROWNUM<參數(shù)2;
另一種是采用top函數(shù)
select top 每頁(yè)的紀(jì)錄數(shù) TABLE.FILED1,TABLE.FILED2,... from TABLE
where TABLE.關(guān)鍵字 not in (select top 需顯示頁(yè)之前的記錄數(shù) TABLE.關(guān)鍵字 from TABLE order by TABLE.關(guān)鍵字) order by TABLE.關(guān)鍵字
值得祝賀的sqlserver2005加入了ROWNUM
新聞熱點(diǎn)
疑難解答
圖片精選