Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使用以下 SQL:
UPDATE `vocabulary` SET `wordEN` = `wordES` WHERE `vocabulary`.`lessonID` = `lessons`.`id` AND `lessons`.`courseID` = 2
但我收到以下错误:
1054 - 'where 子句'中的未知列'lessons.id'
无论如何在MYSQL中这样做吗?也许在查询或其他内容中有查询?
我猜你想update用join. 这可能是您要查找的查询:
update
join
UPDATE vocabulary v join lessons l on v.lessonID = l.id and l.courseID = 2 SET v.wordEN = v.wordES;
编辑:
这也可能有效:
UPDATE vocabulary v SET v.wordEN = v.wordES where v.lessonId in (select id from lessons l where l.courseID = 2);