update table_name_A as A INNER JOIN (select p1,p2 from table_name_B) as B ON A.p1=b.p1 set A.p2=B.p2;