oracle、mysql和sqlserver分页


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推荐
  • —软件人才免语言低担保 赴美带薪读研!—



你可能感兴趣的:(oracle,mysql,sqlserver)