create table zzw_temp (num1 number);select * from zzw_temp for update; /* 5 3 2 13 9 8 4 */select rn from ( select rownum rn,num1 from ( select num1 from zzw_temp order by num1)) where num1=5;drop table zzw_temp purge;
楼上 可以实现 但是如果考虑到100万条以上记录的话 有没有不用多个select的更好的方法?
既然不重復,select count(*) from tb where id<=5 有多少記錄就是排第幾
create table zzw_temp (num1 number);select * from zzw_temp for update;
/*
5
3
2
13
9
8
4
*/select rn from (
select rownum rn,num1 from (
select num1 from zzw_temp order by num1))
where num1=5;drop table zzw_temp purge;
但是如果考虑到100万条以上记录的话 有没有不用多个select的更好的方法?