现在有两张表Device,Customer,Device表中有CustomerID与Customer.ID相关联.现在需要做的是更新Customer表.需要根据Device的SeriesNumber来更新Customer数据.
Device:
SerierNumber CustomerID
A 1
Customer:
ID Email
1 aa@csdn.net
现在有如下数据,Excel形式
SerierNumber Email
A aa@goole.com
如何写一个Update语句来更新Customer表的ID为1的Email为google.com
------解决方案--------------------
- SQL code
--mssqlupdate a set Email=b.Email from Customer a join Device b on (a.id=b.CustomerID)--oracleupdate Customer a set Email=(select Email from Device where CustomerID=a.id)