请问各位老大:在MS SQL Server中能正确运行的Update语句,到My SQL中后要作何修改?
各位老大,以下在MS SQL Server中运行的语句:
Update ShipmentLog
set fldDetailAutoNo=ShipmentPlanDetailTMP.fldAutoNoNew
From ShipmentPlanDetailTMP
Where ShipmentLog.fldDetailAutoNo=ShipmentPlanDetailTMP.fldAutoNoOld
现要在My SQL中运行,但一直提示语法错误,请问要怎样修改,不胜感谢!
------解决方案--------------------MySQL支持在UPDATE时使用连接或者子查询吗?不明就里:
------------------------------------------------
Update a
set
fldDetailAutoNo=b.fldAutoNoNew
From
ShipmentLog a,ShipmentPlanDetailTMP b
Where
a.fldDetailAutoNo=b.fldAutoNoOld
Update ShipmentLog
set
fldDetailAutoNo=(select fldAutoNoNew from ShipmentPlanDetailTMP where fldAutoNoOld=ShipmentLog.fldDetailAutoNo)
from
ShipmentLog
------解决方案--------------------MySQL好象这样写
Update ShipmentLog,ShipmentPlanDetailTMP
set ShipmentLog.fldDetailAutoNo=ShipmentPlanDetailTMP.fldAutoNoNew
Where ShipmentLog.fldDetailAutoNo=ShipmentPlanDetailTMP.fldAutoNoOld
------解决方案--------------------沒用過,幫頂
------解决方案--------------------UP下
------解决方案--------------------刚测试了下,我的好像对的