简体   繁体   English

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

[英]mysql update one table with data from another

I am getting an issue with this update statement: 我收到此更新声明的问题:

update customers
set customers.email = initialsynctemptable.thinkEmail,
    customers.packages = initialsynctemptable.thinkPackages 
FROM customers INNER JOIN initialsynctemptable
ON  customers.id = initialsynctemptable.customerID

and are using mySQL. 并正在使用mySQL。 There is a squigly line under the FROM word. 在FROM字词下有一条弯曲的线。 Essentially I am trying to do an update one table (customers) with data from another table (initialsynctemptable).....Help! 本质上,我试图用另一个表(initialsynctemptable)中的数据来更新一个表(客户)。 Thanking you 感谢您

Try 尝试

UPDATE customers c INNER JOIN 
       initialsynctemptable i ON  c.id = i.customerID
   SET c.email = i.thinkEmail,
       c.packages = i.thinkPackages 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM