多个left join 产生多个结果
生活随笔
收集整理的這篇文章主要介紹了
多个left join 产生多个结果
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
select a.*,to_char(To_date(20160403000000, 'yyyyMMddhh24miss'),'yyyy/mm/dd') as omc_start_time,to_char(To_date(20160404000000, 'yyyyMMddhh24miss'),'yyyy/mm/dd') as omc_end_time,ROUND(sc."切換成功率",2) AS "OMC-源小區切換成功率%",ROUND(sc."同頻切換成功率",2) AS "OMC-源小區同頻切換成功率%",ROUND(sc."異頻切換成功率",2) AS "OMC-源小區異頻切換成功率%",ROUND(sc."切換失敗次數(含準備)",2) AS "OMC-源小區切換失敗次數含準備",sb.alarm as s_alarm,ROUND(tc."切換成功率",2) AS "OMC-目標小區切換成功率%",ROUND(tc."同頻切換成功率",2) AS "OMC-目標小區同頻切換成功率%",ROUND(tc."異頻切換成功率",2) AS "OMC-目標小區異頻切換成功率%",ROUND(tc."切換失敗次數(含準備)",2) AS "OMC-目標小區切換失敗次數含準備",tb.alarm as t_alarmfrom (select x.*,y.cellname scell_name,z.cellname tcell_name,to_number(y.lat) slat,to_number(y.lon) slon,to_number(z.lat) tlat,to_number(z.lon) tlonfrom(select ci_s scell,cellname_s,band_s,lon_s ,lat_s ,ci_d tcell,cellname_d,band_d,lon_d,lat_d,cnt,cnt_total,pingpong_ratio from TMP_TBX_100_0_A6) xinner joinTMP_TBX_100_0_CFG1 y on x.scell=y.ciinner joinTMP_TBX_100_0_CFG1 z on x.tcell=z.ci) aleft join TMP_TBX_100_0_OS3 sb on to_char(round(substr(a.scell,-9)/256,0))=sb.ENBIDleft join TMP_TBX_100_0_OS4 sc on to_number(substr(a.scell,-9))=to_number(sc.ECGI)left join TMP_TBX_100_0_OS3 tb on to_char(round(substr(a.tcell,-9)/256,0))=tb.ENBIDleft join TMP_TBX_100_0_OS4 tc on to_number(substr(a.tcell,-9))=to_number(tc.ECGI)
最后的四個 left join 因為 on的 “=” 號前后條件不同,產生了4條相同的記錄。
除非主鍵關聯,才會是左表的條數。
總結
以上是生活随笔為你收集整理的多个left join 产生多个结果的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 查看表的创建时间
- 下一篇: php网站无法显示,php – 在UTF