sql和mysql内连接更新

来源:互联网 发布:华科工商管理知乎 编辑:程序博客网 时间:2024/06/05 04:34

sql server

update as_landingmodule set ModuleInterface=tb.ChannelInterface FROM (SELECT b.ModuleID,(select ChannelInterface From as_landingchannel where ChannelID=b.ChannelID) as ChannelInterface  FROM (SELECT * FROM as_landingmodulerelation where ProductType='Orther') b inner join as_landingmodule as a on b.ModuleID=a.ModuleID)  tbwhere tb.ModuleID=as_landingmodule.ModuleID;

mysql

update as_landingmodule inner join (SELECT b.ModuleID,(select ChannelInterface From as_landingchannel where ChannelID=b.ChannelID) as ChannelInterface  FROM (SELECT * FROM as_landingmodulerelation where ProductType='Orther') b inner join as_landingmodule as a on b.ModuleID=a.ModuleID)  tbset ModuleInterface=tb.ChannelInterface where tb.ModuleID=as_landingmodule.ModuleID;
1 0