当前位置: 代码迷 >> Oracle技术 >> 外键+改left join的有关问题
  详细解决方案

外键+改left join的有关问题

热度:54   发布时间:2016-04-24 08:28:05.0
外键+改left join的问题
请教一下下面的SQL如何修改为left join的形式SELECT TASKINFO.SID,
  TASKINFO.TASK_NAME,
  TASKINFO.TASK_DESC,
  (case when TASKINFO.Period_Strategy='1' then '是' when (TASKINFO.Period_Strategy is null) then '是' when (TASKINFO.Period_Strategy='0') then '否' end ) Period_Strategy,
  TASKINFO.DOMAIN,
  (select DOMAIN.DOMAIN_NAME from TC_DOMAIN DOMAIN where TASKINFO.DOMAIN = DOMAIN.DOMAIN_NO ) DOMAIN_NAME,
  (SELECT CONTROL.SCHE_TYPE FROM TC_SCHE_CONTROL CONTROL WHERE TASKINFO.SID=CONTROL.TASK_ID) SCHE_TYPE,
  (SELECT SCHE_TYPE_CODE.DESCRIBE FROM TC_SCHE_CONTROL CONTROL, TC_INFO_CODE SCHE_TYPE_CODE
  WHERE TASKINFO.SID=CONTROL.TASK_ID AND CONTROL.SCHE_TYPE=SCHE_TYPE_CODE.CODE(+)
  AND SCHE_TYPE_CODE.PARENT_CODE='SCHE_TYPE') SCHE_TYPE_NAME,
  (SELECT CONTROL.TIMER_SCHE_CYCLE FROM TC_SCHE_CONTROL CONTROL WHERE TASKINFO.SID=CONTROL.TASK_ID ) TIMER_SCHE_CYCLE,
  (SELECT SCHE_CYCLE_CODE.DESCRIBE FROM TC_SCHE_CONTROL CONTROL, TC_INFO_CODE SCHE_CYCLE_CODE
  WHERE TASKINFO.SID=CONTROL.TASK_ID AND CONTROL.TIMER_SCHE_CYCLE=SCHE_CYCLE_CODE.CODE_VALUE
  AND SCHE_CYCLE_CODE.PARENT_CODE='SCHEDULE_CYCLE') SCHE_CYCLE_NAME,
  (SELECT PRIORITY_CODE.DESCRIBE FROM TC_INFO_CODE PRIORITY_CODE WHERE TASKINFO.PRIORITY = PRIORITY_CODE.CODE_VALUE
  AND PRIORITY_CODE.PARENT_CODE = 'PRIORITY') PRIORITY,
  (SELECT STRATEGY_CODE.DESCRIBE FROM TC_INFO_CODE STRATEGY_CODE WHERE TASKINFO.STRATEGY = STRATEGY_CODE.CODE_VALUE(+)
  AND STRATEGY_CODE.PARENT_CODE = 'STRATEGY') STRATEGY,
  TASKINFO.CREATED_BY,
  staffInfo.Staff_Name as user_name,
  staffInfo.Staff_Code as Staff_Code,
  TASKINFO.CREATED_DATE,
  TASKINFO.Last_Updated_By,
  TASKINFO.Last_Updated_Date,
  TASKINFO.Enabled_Flag,
  TASKINFO.Status,
  TASKINFO.Menu_Id,
  menu.menu_name
  FROM TC_TASK_INFO TASKINFO,
  Tc_Staff_Info staffInfo,
  Info_Menu menu
 WHERE
  TASKINFO.Menu_Id=menu.sid and
  TASKINFO.Last_Updated_By = staffInfo.SID(+)
 ORDER BY TASKINFO.SID DESC;

------解决方案--------------------
额 刚进来看到 已经解决了?
  相关解决方案