Quantcast
Channel: IT社区推荐资讯 - ITIndex.net
Viewing all articles
Browse latest Browse all 11804

oracle、mysql和sqlserver分页

$
0
0

sql server row number分页:

 select b.* FROM (
		select row_number() over(order by t.id desc) as rownumber, 
		t.* from table_name t
		) as b where b.rownumber <= #endIndex# and b.rownumber >= #beginIndex#



mysql limit分页:

SELECT t.*
        FROM 
             (SELECT id FROM table_name
        ORDER BY gmt_create DESC
        LIMIT  #startRow#, #pageSize#) AS a, table_name AS t
        FORCE INDEX(PRIMARY)
        WHERE a.id = t.id


oracle分页:

select *
		from (
		select t1.* , rownum linenum
		from (
				select
		t.*
       from table_name t order by
			    	t.GMT_MODIFY desc
			) t1
			where rownum <= #endIndex#) t2
		where t2.linenum >= #beginIndex#


已有 0人发表留言,猛击->> 这里<<-参与讨论


ITeye推荐




Viewing all articles
Browse latest Browse all 11804

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>