当前位置:首页 >> orAClE with As >>

orAClE with As

ORACLE WITH AS和直接from效率上面有什么不一样的嘛 单纯的执行这一次没有什么不同,效率差不多 如果需要反复引用结果就用WITH。with as 主要是对于语句中多次引用sql结果集(中间集),一次生成,多次引用,执行效率非常高

with a1 as (select XS,QY,YHM,YHXM from XTGL_YH t1 left join XTGL_JS t2 on t1.JSBH = t2.BH where t1.ZT = '1')select XS,YHM from a1union all select XS,YHM from a1 是因为t2和on之间没加空格吧。with...as里面可以使用left join的。

with as语法 –针对一个别名 with tmp as (select * from tb_name) –针对多个别名 with tmp as (select * from tb_name), tmp2 as (select * from tb_name2), tmp3 as (select * from tb_name3), 其实就是把一大堆重复用到的sql语句放在with as里

你要问支持吗,我就回答:支持 顺便告诉你怎么用: with TT as( --模拟生一个20行的数据 SELECT LEVEL AS lv FROM DUAL CONNECT BY LEVEL < 20 ) select lv from TT WHERE lv > 10 AND lv < 15

oracle10应该支持这样的写法: with a as (select * from test) select * from a; oracle11支持这样的写法: with c(no,name,address) as (select id,name,addr from test where id=1 or id=2) select * from c;

如果select的结果有多处地方会用到,那么with as会把select的结果缓存起来,不用每次都select from,少写代买,而且效率也比较高。

with temp as (select /*+hint1*/ ******)select /*+hint2*/* from temp;--hint1作用于temp内结果集,hint2作用域temp外

12345with temp as (select /*+hint1*/ ******)select /*+hint2*/* from temp;--hint1作用于temp内结果集,hint2作用域temp外

with as 主要是对于语句中多次引用sql结果集(中间集),一次生成,多次引用,执行效率非常高.

oracle with as Oracle作为 oracle with as Oracle作为

网站首页 | 网站地图
All rights reserved Powered by
copyright ©right 2010-2021。