日期:2014-05-17  浏览次数:20932 次

寻找高手,SQL:informix-->Oracle
这是个多表外连接的问题,这是informix的写法,现在应用要签到Oracle中,总是写不对,表太多了,望高手指教一二
SQL code

select 
a.int_id,
a.omc_id,
b.msc_name,
a.timestamp,
a.routeset_id,
c.linkset_id,
a.routeset_id,
a.routeset_priority,
d.national_network_dpc,
b.dest_spc
from 
c_hua_MSCServerMTP3SignallingRoute a,
c_hua_msc_info b,
outer c_hua_linkset  c,
outer c_hua_SignallingPoint d
where 
a.msc_fdn = b.fdn and 
a.linkset_index = c.linkset_index and 
a.signallingpoint_fdn = d.fdn and
 a.msc_fdn = c.msc_fdn 



------解决方案--------------------

select 
a.int_id,
a.omc_id,
b.msc_name,
a.timestamp,
a.routeset_id,
c.linkset_id,
a.routeset_id,
a.routeset_priority,
d.national_network_dpc,
b.dest_spc
from 
c_hua_MSCServerMTP3SignallingRoute a,
c_hua_msc_info b,
full join c_hua_linkset c on a.linkset_index = c.linkset_index and a.msc_fdn = c.msc_fdn 
full join c_hua_SignallingPoint d on a.signallingpoint_fdn = d.fdn
where a.msc_fdn = b.fdn ;
------解决方案--------------------
select 
a.int_id,
a.omc_id,
b.msc_name,
a.timestamp,
a.routeset_id,
c.linkset_id,
a.routeset_id,
a.routeset_priority,
d.national_network_dpc,
b.dest_spc
from 
c_hua_MSCServerMTP3SignallingRoute a,
c_hua_msc_info b,
c_hua_linkset c,
c_hua_SignallingPoint d
where 
a.msc_fdn = b.fdn and 
a.linkset_index = c.linkset_index and 
a.signallingpoint_fdn = d.fdn and
 a.msc_fdn = c.msc_fdn 

------解决方案--------------------
从你写的sql来看,一a表为主表,可以把a的所有数据选出来。其他的有有没有数据都可以的。

select 
a.int_id,
a.omc_id,
b.msc_name,
a.timestamp,
a.routeset_id,
c.linkset_id,
a.routeset_id,
a.routeset_priority,
d.national_network_dpc,
b.dest_spc
from 
c_hua_MSCServerMTP3SignallingRoute a,
left outer join c_hua_msc_info on b a.msc_fdn = b.fdn 
left outer join c_hua_linkset c on a.linkset_index = c.linkset_index 
left outer join outer c_hua_SignallingPoint d on a.signallingpoint_fdn = d.fdn