0
我想基於另一個表中的某個值是否爲'999'來更新表。以下是代碼。我正在穿越數據庫,所以我對語法有點困惑。使用sql連接更新表
我收到此錯誤: SQL錯誤:關鍵字'左'附近的語法不正確。
declare @ProcessDate datetime
set @ProcessDate=getdate()
update ${BccrDatabase}..ReturnsHeader
left join ${JdeDatabase}.f47011 poh on --Temp Header
poh.SYEDOC = ReturnsHeader.DocumentNumber and poh.SYEDCT = 'EP'
left join ${JdeDatabase}.f4201 soh on --Prod Header
soh.SHKCOO = poh.SYEKCO
and soh.SHDOCO = poh.SYDOCO
and soh.SHDCTO = poh.SYEDCT
left join ${JdeDatabase}.f4211 sod on --Production Detail
sod.SDKCOO = soh.SHKCOO
and sod.SDDOCO = soh.SHDOCO
and sod.SDDCTO = soh.SHDCTO
left join jde_crp.crpdta.f42119 hist on --History Detail
hist.sddoco = soh.SHDOCO and
hist.sdkcoo = soh.SHKCOO and
hist.sddcto = soh.SHDCTO
set
[email protected]
where
SentToEdiDate is null
and ApprovalStepID=4 -- Complete
and [email protected]
and sod.SDNXTR is not null or hist.SDNXTR is not null
and sod.SDNXTR = '999' or hist.SDNXTR = '999'
哪些DBMS您使用的? – araknoid 2013-02-26 19:00:33
請不要刪除您的問題的相關內容。這被認爲是破壞行爲。它使郵件不會對未來的訪問者有用。 – jadarnel27 2013-04-11 15:29:41