在Oracle中,要按特定条件查询前N条记录,用个rownum就搞定了。
但是 rownum是不能用>符号的
rownum对于大于某值的查询条件直接认为是false的,但是可以间接的让它转为认为是true的。那就必须使用子查询。
例如:
select n.id (select s.id rownum no from ts_ss_user s ) n where no>1 and no<=10
在Oracle中,要按特定条件查询前N条记录,用个rownum就搞定了。
但是 rownum是不能用>符号的
rownum对于大于某值的查询条件直接认为是false的,但是可以间接的让它转为认为是true的。那就必须使用子查询。
例如:
select n.id (select s.id rownum no from ts_ss_user s ) n where no>1 and no<=10