用另一个表中的数据更新 mysql 表
是否可以使用子选择在 mysql 5.0 上运行 UPDATE 命令.
Is it possible to run an UPDATE command on mysql 5.0 with a sub select.
我想运行的命令是这样的:
The command I would like to run is this:
UPDATE book_details
SET live = 1
WHERE ISBN13 = '(SELECT ISBN13 FROM book_details_old WHERE live = 1)';
ISBN13 当前存储为字符串.
ISBN13 is currently stored as a string.
这应该更新 10k+ 行.
This should be updating 10k+ rows.
谢谢,
威廉
推荐答案
稍作改动就搞定了:
UPDATE book_details
SET live = 1
WHERE ISBN13 in (SELECT ISBN13 FROM book_details_old WHERE live = 1);
相关文章