分享一个经验
需求:Oracle中,根据COST优先级取最优先的一条记录
脚本:
select ... from ... where ... and rownum=1 order by cost
实际不能如愿,取得的结果不是最优先的。原因是where在很早就执行了,等到order的时候,只有一条记录。改为以下解决
with a as (select ... order by cost) select * from A where rownum=1
标签:...,次序,cost,SQL,ORACLE,rownum,where,order,select From: https://www.cnblogs.com/glowinghe/p/17261193.html