update table1 set a  areaid= (select  areaid from table2 where city =a.city)
 

解决方案 »

  1.   

    回复人: lizhaogui() ( ) 信誉:100  2005-10-19 11:06:00  得分: 0  
     
     
       update table1 set a  areaid= (select  areaid from table2 where city =a.city)子查询的返回值好像不只一个吧?distinct
       
     
      

  2.   

    update table1 set a  areaid= (select distinct  areaid from table2 where city =a.city)
    update table1 set a  areaid= (select   areaid from table2 where city =a.city group by areaid)
      

  3.   

    select dstinct city, areaid
      

  4.   

    update table1 set a  areaid= (select distinct  areaid from table2 where city =a.city)