gpt4 book ai didi

mysql - 使用另一个表中的值更新一个表中的数据

转载 作者:行者123 更新时间:2023-11-28 23:30:24 25 4
gpt4 key购买 nike

我有 2 个表,showsshow_photo

显示结构:

enter image description here

show_photo 结构:

enter image description here

我想做的是用 show.year
更新 show_photo.modified 列这是我尝试过的,但没有任何更新。

UPDATE show_photo t2
JOIN shows t1 ON t1.id = t2.show_id
SET t2.modified = t1.year;

最佳答案

将我的评论转换为答案:

Change the column type from TIMESTAMP to VARCHAR first, run the UPDATE query; and again change the data type from VARCHAR to INT

您当前的表有 modified 列设置为 TIMESTAMP。但是,您尝试将其值更新为整数,这将失败。

关于mysql - 使用另一个表中的值更新一个表中的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37509741/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com