3,499
社区成员
发帖
与我相关
我的任务
分享
--查询条件只涉及到a,e,c,d,b,g,
select distinct a.TERMINAL_ID,
a.TERMINAL_ADDR,
a.STATUS_CODE,
a.COLL_MODE,
a.TERMINAL_TYPE_CODE,
a.ID,
a.CP_NO,
e.NAME as terminal_name,
c.cons_no,
c.cons_name
from epma.R_TMNL_RUN a,
epma.g_line b,
epma.c_cons c,
epma.r_cp_cons_rela d,
epma.r_cp e,
epma.g_subs f,--1
epma.o_org g,
epma.g_subs_line_rela h--2
where a.CP_NO = e.CP_NO(+)
and a.cp_no = d.cp_no(+)
and d.cons_id = c.cons_id(+)
--下面这三个连接条件你在查询中都没有用到,你真觉得他们有用吗?
--如果没用,那么可以去掉这几个表:h,f
--------------------------------
--and d.cons_id = b.cons_id(+)--
--and b.line_id = h.line_id(+)--
--and h.subs_id = f.subs_id(+)--
------------------------------
and c.org_no = g.org_no(+)
and g.org_no like '32401%%'
and a.TERMINAL_TYPE_CODE = '05'-- 低压集中器
order by a.TERMINAL_ID asc