select * from
(select a.*,rownum row_num from
(select * from mytable t order by t.id desc) a
) b where b.row_num between 1 and 10
下面是 一条通用的分页代码
String sql = "select rownum as row_num,t__.* from (" + innerSql + ") t__"; sql = "select X_.* from(" + sql + ") X_ where " + "X_.row_num>=? and X_.row_num < ? ";