MySQL从一张表更新到另一张表,但条件不起作用? [英] MySQL update from one table to another with condition not working?

查看:91
本文介绍了MySQL从一张表更新到另一张表,但条件不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这个问题上,我尝试了一种似乎对其他人有用的解决方案:

I have tried a solution that seems to work for someone else on this question:

从表b where(条件)中更新表a 我似乎无法正常工作,MySql给了我一个语法错误.

Update table a from table b where (conditions) I can not seem to get it working, MySql gives me a syntax error.

我有两个表,我需要将一个表中的一列更新为另一个ID,这两个表中的ID都匹配.

I have two tables, and I need to update a column in one table to the value of another column where an id matches in both tables.

更新video_data SET video_data.date_timestamp = video.date_timestamp FROM video_data加入视频on video_data.video_id = video.video_id

UPDATE video_data SET video_data.date_timestamp = video.date_timestamp FROM video_data JOIN video ON video_data.video_id = video.video_id

我不确定我的语法出了什么问题.我很累,也许只是我的眼睛在和我玩.感谢您的帮助!

I am not sure what the issue is with my syntax. I am quite tired and maybe it is just my eyes playing with me. Thanks for the help!

推荐答案

尝试以下语法:

UPDATE video_data, video 
SET video_data.date_timestamp = video.date_timestamp
WHERE  video_data.video_id = video.video_id

这篇关于MySQL从一张表更新到另一张表,但条件不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆