MYSQL语句有关问题
程序员文章站
2024-04-04 21:47:53
...
MYSQL语句问题?
------解决方案--------------------
Every derived table must have its own alias
每一个派生表必须有自己的别名
UPDATE
(
SELECT WorkID,
WK.PpjID,
WD.CheckupPoint,
WD.AdjustPoint,
WD.FactPoint,
WE.IsSpecial,
WK.WorkType,
WK.WorkStatus
FROM `Work` WK LEFT JOIN WorkDesign WD ON WK.WorkID=WD.Work_id
LEFT JOIN WorkEditionDot WE ON WE.EditionDotID=WE.EditionDotID WHERE `WK`.WorkID IN
(SELECT `W`.WorkID FROM `Work` W WHERE W.PpjID=18035 AND (`W`.WorkStatus='已出稿' OR `W`.WorkStatus='已定稿')))
SET WD.CheckupPoint=WD.AdjustPoint+WD.FactPoint WHERE WK.PpjID=18035
红色的部分就是一个派生表,需要有别名
被修改的是查询结果,你这样能修改成功吗?
- SQL code
UPDATE (SELECT WorkID,WK.PpjID,WD.CheckupPoint,WD.AdjustPoint,WD.FactPoint, WE.IsSpecial, WK.WorkType, WK.WorkStatus FROM `Work` WK LEFT JOIN WorkDesign WD ON WK.WorkID=WD.Work_idLEFT JOIN WorkEditionDot WE ON WE.EditionDotID=WE.EditionDotID WHERE `WK`.WorkID IN(SELECT `W`.WorkID FROM `Work` W WHERE W.PpjID=18035 AND (`W`.WorkStatus='已出稿' OR `W`.WorkStatus='已定稿'))) SET WD.CheckupPoint=WD.AdjustPoint+WD.FactPoint WHERE WK.PpjID=18035
------解决方案--------------------
Every derived table must have its own alias
每一个派生表必须有自己的别名
UPDATE
(
SELECT WorkID,
WK.PpjID,
WD.CheckupPoint,
WD.AdjustPoint,
WD.FactPoint,
WE.IsSpecial,
WK.WorkType,
WK.WorkStatus
FROM `Work` WK LEFT JOIN WorkDesign WD ON WK.WorkID=WD.Work_id
LEFT JOIN WorkEditionDot WE ON WE.EditionDotID=WE.EditionDotID WHERE `WK`.WorkID IN
(SELECT `W`.WorkID FROM `Work` W WHERE W.PpjID=18035 AND (`W`.WorkStatus='已出稿' OR `W`.WorkStatus='已定稿')))
SET WD.CheckupPoint=WD.AdjustPoint+WD.FactPoint WHERE WK.PpjID=18035
红色的部分就是一个派生表,需要有别名
被修改的是查询结果,你这样能修改成功吗?
相关文章
相关视频
上一篇: PHP&MYSQL复习提纲
下一篇: memcached部署