Questions tagged «mysql-error-1093»

16
MySQL错误1093-无法在FROM子句中指定目标表进行更新
story_category我的数据库中有一个表,其中的条目已损坏。下一个查询返回损坏的条目: SELECT * FROM story_category WHERE category_id NOT IN ( SELECT DISTINCT category.id FROM category INNER JOIN story_category ON category_id=category.id); 我试图删除它们执行: DELETE FROM story_category WHERE category_id NOT IN ( SELECT DISTINCT category.id FROM category INNER JOIN story_category ON category_id=category.id); 但是我得到了下一个错误: #1093-您无法在FROM子句中指定目标表'story_category'进行更新 我该如何克服呢?

10
您不能在FROM子句中指定要更新的目标表
我有一个简单的mysql表: 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), …

4
SQL DELETE与JOIN另一个表在WHERE条件
我必须从中删除guide_category与guide表没有任何关系的行(无效关系)。 这是我想做的,但是它当然不起作用。 DELETE FROM guide_category AS pgc WHERE pgc.id_guide_category IN (SELECT id_guide_category FROM guide_category AS gc LEFT JOIN guide AS g ON g.id_guide = gc.id_guide WHERE g.title IS NULL) 错误: 您不能在FROM子句中指定目标表'guide_category'进行更新
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.