select * from (select row_.*, rownum rownum_ from (
select userinfo.id as "id"
from tbl_user_teacher teacherinfo,tbl_user_info userinfo
where 1=1
and teacherinfo.id = userinfo.id
and userinfo.status = 1
and userinfo.region_id is not null
order by userinfo.region_id asc ) row_
where rownum <= 20 )
where rownum_ >=11
select userinfo.id as "id"
from tbl_user_teacher teacherinfo,tbl_user_info userinfo
where 1=1
and teacherinfo.id = userinfo.id
and userinfo.status = 1
and userinfo.region_id is not null
order by userinfo.region_id asc ) row_
where rownum <= 20 )
where rownum_ >=11
解决方案 »
- ora-06502 pl sql 数字或值错误 字符串缓冲区太小
- 求一个SQL编写方向问题
- 在命令行中如何创建存储过程
- 求SQL语句(两个表,分组,统计)
- 哪位熟悉OracleMigrationWorkbench-ORACLE数据迁移工具的安装使用?
- 高分求一sql语句.
- 在pl/sql->command window 中执行后并没有输出结果呀?
- Oracle9i 的预编译工具 Pro* C 怎么找,在哪里,还要安装什么吗,谢谢!!急
- 各位大哥、大姐们!求SQL语句一条
- 在线等待:inner join问题,各位DX帮忙!!
- 使用 oracle managed odp.net , 在Insert into时 , 使用returning 报网络错误 .
- 怎么查询至少选修了 某个学生选修的所有课程
select t1.* , rownum rn from (
select * from emp
)t1 where rownum<=10
)t2 where rn>4;
我看你的意思是,取region_id的第11到20名,没有问题。
FROM
(SELECT row_.id,
rownum rn1
FROM
(SELECT ui.id FROM tbl_user_info ui ORDER BY region_id
) row_
WHERE rownum <= 10
) t1 ,
(SELECT row_.id,
rownum rn2
FROM
(SELECT ui.id FROM tbl_user_info ui ORDER BY region_id
) row_
) t2
WHERE t1.rn1 = t2.rn2
AND t1.id <> t2.id;这个执行结果是 10因为region_id有重复的,如何换成id就没没有了
那你在group by region_id 去除重复数据。。