当前位置: 代码迷 >> Sql Server >> 大家帮忙看一下这段SQL文解决办法
  详细解决方案

大家帮忙看一下这段SQL文解决办法

热度:104   发布时间:2016-04-27 16:00:47.0
大家帮忙看一下这段SQL文
update     MBPAPP_BBS_TAT_WEEKLY_TBL  
set   DISTRICT   =   FR_MASTER_TBL.VALUE
where   MBPAPP_DFB_THREAD_TBL.TAT   <>   NULL

LEFT   JOIN   FR_MASTER_TBL   ON  
MBPAPP_BBS_TAT_WEEKLY_TBL.DISTRICT   =   FR_MASTER_TBL.ID
  AND     FR_MASTER_TBL..DIVISION   =   '02 '
LEFT   JOIN   MBPAPP_DFB_THREAD_TBL   ON  
  MBPAPP_BBS_TAT_WEEKLY_TBL.ID   =   MBPAPP_DFB_THREAD_TBL.DFB_THREAD_ID

-------------
是在LEFT附近出错.不明白

------解决方案--------------------
update MBPAPP_BBS_TAT_WEEKLY_TBL
set DISTRICT = B.VALUE

FROM MBPAPP_BBS_TAT_WEEKLY_TBL a LEFT JOIN
FR_MASTER_TBL B ON A.DISTRICT = B.ID LEFT JOIN
MBPAPP_DFB_THREAD_TBL C ON A.ID = C.DFB_THREAD_ID

where A.TAT <> NULL
AND B.DIVISION = '02 '
------解决方案--------------------
update a
set a.DISTRICT = b.VALUE
from MBPAPP_BBS_TAT_WEEKLY_TBL a
left join FR_MASTER_TBL b on a.DISTRICT = b.ID and b.DIVISION = '02 '
left join MBPAPP_DFB_THREAD_TBL c on a.ID = c.DFB_THREAD_ID
where c.TAT <> null
  相关解决方案