oracle join on 数据过滤问题
来源:爱站网时间:2019-09-04编辑:网友分享
oracle join on 数据过滤问题大家了解吗?相信通过爱站技术频道的介绍,大家对这方面知识都有了进一步的了解,感兴趣的朋友跟着小编的步伐来好好学习吧
!
oracle join on 数据过滤问题大家了解吗?相信通过爱站技术频道的介绍,大家对这方面知识都有了进一步的了解,感兴趣的朋友跟着小编的步伐来好好学习吧
!
代码如下:
select a.f_username
from
(
SELECT /*+parallel(gu,4)*/distinct gu.f_username
FROM t_base_succprouser gu
where gu.f_expectenddate > (select trunc(sysdate,'Y')FROM DUAL)
and gu.f_lotid=1
and gu.f_playid=4
and gu.f_paymoney>=1500
) A
left join
(
select
from t_base_vip_customes
and ((vu.f_passeddate is null ) or (vu.f_passeddate > trunc(sysdate,'Y') ))
and ((vu.f_lotid is null ) or (vu.f_lotid=1))
and ((vu.f_playid is null ) or (vu.f_playid=4))
and ((vu.f_condtionid is null ) or (vu.f_condtionid=3))
)B
on A.f_username=B.f_usernam
where b.f_username is null
采用下面的语句 只能查出部分用户
复制代码 代码如下:
SELECT /*+parallel(gu,4)*/distinct gu.f_username
FROM t_base_succprouser gu
left join t_base_vip_customes VU on gu.f_username=vu.f_username
gu.f_expectenddate > (select trunc(sysdate,'Y')FROM DUAL)
and gu.f_lotid=rec_viplotplay.f_lotid
and gu.f_playid=rec_viplotPlay.f_Playid
and gu.f_paymoney>=rec_viplotPlay.F_Conditon_ValuesA
and ((vu.f_passeddate is null ) or (vu.f_passeddate > trunc(sysdate,'Y') ))
and ((vu.f_lotid is null ) or (vu.f_lotid=rec_viplotplay.f_lotid))
and ((vu.f_playid is null ) or (vu.f_playid=rec_viplotPlay.f_Playid))
and ((vu.f_condtionid is null ) or (vu.f_condtionid=rec_viplotPlay.F_CondtionID))
and vu.f_username is null
执行计划:
复制代码 代码如下:
SELECT STATEMENT, GOAL = ALL_ROWS
HASH UNIQUE
NESTED LOOPS OUTER
PARTITION RANGE ALL
TABLE ACCESS FULL Object name=T_BASE_SUCCPROUSER
VIEW
FILTER
TABLE ACCESS FULL Object name=T_BASE_VIP_CUSTOMES
FAST DUAL
后来改成了下面就能全部查出来了
以上就是关于oracle join on 数据过滤问题,你学会了吗?提醒大家在选择学习平台的时候一定要多方考察,最好你能咨询爱站技术频道!
上一篇:ORCLE 表中列的修改