update select 多字段

update Countrys set (
    Abbreviation_cn,
    Abbreviation_en,
    Two_code,Three_code,
    Number_code)= 
    (select  [cn_name],
            [en_name],
            [two_code],
            [free_code],
            convert(int,number_code) as [number_code]
     from  Country.dbo.worlds a where a.cn_name=Countrys.Abbreviation_cn)

 

    
UPDATE Countrys   SET  Abbreviation_cn= Country.dbo.worlds.cn_name,
                Abbreviation_en=Country.dbo.worlds.en_name,
                Two_code=Country.dbo.worlds.two_code,Three_code=Country.dbo.worlds.free_code
                   FROM Countrys,Country.dbo.worlds WHERE Countrys.chinese_name+' '+Countrys.english_name = Country.dbo.worlds.all_name

 

你可能感兴趣的:(select)