oracle 不支持Top的。top是sqlserver的。
oracle中用rownum实现。
代码如下:(如果不想排序两层就够了)
select * from(
select rownum myrownum,authorid,postnum from
(
select authorid,postnum from bbs_authors order by postnum desc ))
where myrownum between 10 and 20
oracle中用rownum实现。
代码如下:(如果不想排序两层就够了)
select * from(
select rownum myrownum,authorid,postnum from
(
select authorid,postnum from bbs_authors order by postnum desc ))
where myrownum between 10 and 20
+ 你的sql语句
+") C ) "
+ "WHERE NUMROW >0 AND NUMROW <= 10";
where rownum<=10
String sql ="SELECT * FROM ( SELECT C.*, ROWNUM AS NUMROW FROM ( "
+ 你的sql语句
+") C ) "
+ "WHERE NUMROW >0 AND NUMROW <= 10";
where tk < 10 ;
where tk < 10 ;
where tk < 10 ;