不能指定目标表以便在FROM子句中更新
CREATE TABLE IF NOT EXISTS `pers` ( `persID` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(35) NOT NULL, `gehalt` int(11) NOT NULL, `chefID` int(11) DEFAULT NULL, PRIMARY KEY (`persID`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;INSERT INTO `pers` (`persID`, `name`, `gehalt`, `chefID`) VALUES(1, 'blb', 1000, 3),(2, 'as', 1000, 3),(3, 'chef', 1040, NULL);
UPDATE pers P SET P.gehalt = P.gehalt * 1.05 WHERE (P.chefID IS NOT NULL OR gehalt < (SELECT ( SELECT MAX(gehalt * 1.05) FROM pers MA WHERE MA.chefID = MA.chefID) AS _pers))
慕妹3146593
德玛西亚99
缥缈止盈
相关分类