Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 尝试从一个表更新另一个表_Mysql - Fatal编程技术网

Mysql 尝试从一个表更新另一个表

Mysql 尝试从一个表更新另一个表,mysql,Mysql,我创建了此查询,但似乎无法使其正常工作。我必须承认我在这方面是新手,我以前写过一些简单的查询,但我以前从未尝试过从一个表更新另一个表。我在这里看过一些相关的帖子,但可能我只是太过密集。。。他们看不出有什么帮助。以下是我正在使用的: Insert into `customers_marketing_options` (`created_on`) select `created_on`, from `customers` where `customers`.`custome

我创建了此查询,但似乎无法使其正常工作。我必须承认我在这方面是新手,我以前写过一些简单的查询,但我以前从未尝试过从一个表更新另一个表。我在这里看过一些相关的帖子,但可能我只是太过密集。。。他们看不出有什么帮助。以下是我正在使用的:

Insert into `customers_marketing_options` (`created_on`) 
    select `created_on`,
    from `customers`
    where `customers`.`customer_id`= `customers_marketing_options`.`customer_id`;

非常感谢您的帮助。

谢谢您的帮助。所以这是我错过的加入。。。以前从未用过。我会好好研究的。再次感谢。
UPDATE customers_marketing_options 
JOIN customers ON customers.customer_id = customers_marketing_options.customer_id
SET customers_marketing_options.created_on = customers.created_on