rownum是什么意思_rownum
2023-03-27 02:53:20 来源:互联网
(资料图片仅供参考)
1、用rownum获得结果集前n行的正确sql语句select * from (select rownum as num,a.* from a) bwhere b.num<=nrownum只是一个虚拟的列,所以直接比较rownum<=n是没办法实现你要的前n行要求的,只有将它转化成真实的列才行。
2、select *from a where isactive=1这个才是你要拿的结果select *from (select *from a where isactive=1) twhere rownum <= n12312346546。
本文到此分享完毕,希望对大家有所帮助。
关键词: