免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5754 | 回复: 1
打印 上一主题 下一主题

[求助] oracle 同一张表关联自身优化 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2014-01-24 01:16 |只看该作者 |倒序浏览
本帖最后由 qq3632 于 2014-01-24 01:16 编辑

sql语句多次关联自身,如何优化,各位帮帮忙看下
sql如下:
select b.phone_no,c.channel_name,decode(b.run_code,'A','有效','无效') run_code,
(select d.logic_data from  dchncustmsgdet20131201 d where d.attr_id='100000047' and d.id_no = b.id_no) main_this_tc,
(select d.logic_data from  dchncustmsgdet20131201 d where d.attr_id='1200000023' and d.id_no = b.id_no) main_last_tc,
(select d.logic_data from  dchncustmsgdet20131201 d where d.attr_id='100000049' and d.id_no = b.id_no) bonus_blnc,
(select d.logic_data from  dchncustmsgdet20131201 d where d.attr_id='100000033' and d.id_no = b.id_no) convert_type,
(select e.logic_data from  dchncustdatadet20131201 e where e.attr_id ='100000109' and e.id_no = b.id_no) innet_store
from dchncustmsg20131201 b,channel c ,CHANNEL_TYPE_CONFIG d
where b.chnorgunit_id = c.channel_id
and c.CHANNEL_TYPE_CD = d.CHANNEL_TYPE_ID;

执行计划如下:

论坛徽章:
7
天蝎座
日期:2013-08-16 23:19:32丑牛
日期:2014-01-08 09:20:14寅虎
日期:2014-01-11 11:03:44午马
日期:2014-04-28 11:02:40天秤座
日期:2014-05-16 23:24:24摩羯座
日期:2014-07-20 10:46:04卯兔
日期:2014-08-08 15:21:41
2 [报告]
发表于 2014-01-24 20:05 |只看该作者
没有看到2张表,全表扫描吗
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP