日期:2014-05-16 浏览次数:20463 次
ORACLE 左连接:
1.使用(+)表示:
SELECT A.OID,
?????? A.VALUE,
?????? A.NE_TYPE_OID,
?????? NVL(B.STATUS, '1') STATUS,
?????? A.TYPE,
?????? A.STARTTIME START_TIME
? FROM ALARM_E A, ALARM_E_CLEAR_TIME B
?WHERE A.OID = B.ALARM_EVENT_OID(+);???????
??????????????
2.使用left join表示:
SELECT A.OID,
?????? A.VALUE,
?????? A.NE_TYPE_OID,
?????? NVL(B.STATUS, '1') STATUS,
?????? A.TYPE,
?????? A.START_TIME
? FROM (select OID,
?????????????? KPI_DEFINE_OID,
?????????????? ALARM_DEFINE_OID,
?????????????? ALARM_THRESHOLD_LINE_OID,
?????????????? THRESHOLD_VALUE,
?????????????? REPORT_TIME,
?????????????? SLICE_TYPE,
?????????????? VALUE,
?????????????? COLOR_LEVEL,
?????????????? COMP_TYPE,
?????????????? NE_OID,
?????????????? NE_TYPE_OID,
?????????????? TYPE,
?????????????? STARTTIME START_TIME
????????? from ALARM_E) A
? left join (select STATUS, ALARM_EVENT_OID, END_TIME
?????????????? from ALARM_E_CLEAR_TIME) B on A.OID = B.ALARM_EVENT_OID;
?
上面的两个左连接语句显示的结果是相同的,左连接,(+放在等号的右边)