日期:2014-05-16  浏览次数:20672 次

mysql送分题……
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_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

报错;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='已定稿'))) t
 SET CheckupPoint=AdjustPoint+FactPoint WHERE PpjID=18035