update TR_P_Customer set F_Age=(select F_Age from TR_P_TEmpCustomer) 
,F_Sex=(select F_Sex from TR_P_TEmpCustomer),F_Name=(select F_Name from TR_P_TEmpCustomer) 
where F_Key=1111 如以上Sql,我需要更新多个字段的值,而这个值是从其它表查询出来的,考虑到这样数据量过大的话,效率会很低,请问有什么方法可以解决,谢谢!

解决方案 »

  1.   

    update TR_P_Customer set F_Age= T. F_Age
    ,F_Sex=T.F_Sex,F_Name=T.F_Name 
    from (select F_Age,F_Sex,F_Name from TR_P_TEmpCustomer) T
    where F_Key=1111 
      

  2.   

    好像有问题吧, 万一SELECT语句返回多条记录的话你的更新好像就不准确吧
      

  3.   

    update TR_P_Customer set F_Aget=t.F_Age,F_Sex=f.F_Sex,F_Name=n.F_Name 
    from TR_P_TEmpCustomer t,TR_P_TEmpCustomer f,TR_P_TEmpCustomer n
    where TR_P_Customer.F_Key=1111