select * from tb where rownum <=(select count(*)/4 from tb) oracle就没有top xx% persent-_-||
select * from tb where rownum <=(select count(*) from tb)*0.25; select * from tb where rownum <=(select count(*)/4 from tb) ; select * from tb where rownum <=(select count(*) from tb)/4; 都可以。
select * from tb where rownum <=(select count(*)/4 from tb) ; 绝对正确!
select * from tb where rownum <=(select count(*) from tb)*0.25; select * from tb where rownum <=(select count(*)/4 from tb) ; select * from tb where rownum <=(select count(*) from tb)/4; 实践后才能知道真的行不行!大家都试试!
SELECT * FROM tableA WHERE ROWNUM<=(select count(*)/4 from tableA);
SELECT * FROM tableA WHERE ROWNUM<=(select count(*)/4 from tableA);
select * from tb where rownum <=(select count(*)/4 from tb) ;
select * from tb where rownum <=(select count(*) from tb)/4;
都可以。
select * from tb where rownum <=(select count(*)/4 from tb) ; 绝对正确!
select * from tb where rownum <=(select count(*) from tb)*0.25;
select * from tb where rownum <=(select count(*)/4 from tb) ;
select * from tb where rownum <=(select count(*) from tb)/4;
实践后才能知道真的行不行!大家都试试!
这个只是个大概的比例,不是准确的
而且为什么要25%???一个固定数不是很好吗?