sql和mysql内连接更新

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) tb where 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) tb set ModuleInterface=tb.ChannelInterface where tb.ModuleID=as_landingmodule.ModuleID;

你可能感兴趣的:(sql,mysql)