MySQL update from one table to another with condition not working?

前端 未结 3 870
灰色年华
灰色年华 2021-01-03 03:10

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

Update table a from table b where (conditions) I can not seem to get it working, MySql

3条回答
  •  走了就别回头了
    2021-01-03 03:45

    Try this:

    UPDATE video_data SET date_timestamp = (SELECT video.date_timestamp FROM video WHERE  video.video_id = video_data.video_id)
    

    Although the error in your actual query is simply that you missed a "SELECT"

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

    But I don't think it is what you want it to be.

提交回复
热议问题