update table1 set col1=(select col2 from table2 where table1.pk=table2.pk)
where exists(select col2 from table2 where table1.pk=table2.pk);

解决方案 »

  1.   

    子查询返回的值多于一个。当子查询跟随在 =、!=、<、<=、>、>= 之后,或子查询用作表达式时,这种情况是不允许的。
    按照你的方法,它报的是这个错。
      

  2.   

    update  table1  set  col1=(select  max(col2)  from  table2  where  table1.pk=table2.pk)  
    where  exists(select  col2  from  table2  where  table1.pk=table2.pk);
      

  3.   

    MAX是取最大值呀!我现在是要把整列数据update到另一张表中!
      

  4.   

    把max()换成 distinct()呢?