两表更新字段的有关问题

两表更新字段的问题?
有A,B两表,A表中有Pid字段,B表中有ID,Pid字段,当A表中的Pid字段值与B表中的Pid字段值相同时,取B表中的ID值更新A表的Pid值。
比如:A.Pid   =   234,B.id   =   5,B.Pid   =   234,更新后A.Pid   =   5;   这个Update语名如何写?

------解决方案--------------------
有A,B两表,A表中有Pid字段,B表中有ID,Pid字段,当A表中的Pid字段值与B表中的Pid字段值相同时,取B表中的ID值更新A表的Pid值。
比如:A.Pid = 234,B.id = 5,B.Pid = 234,更新后A.Pid = 5; 这个Update语名如何写?

update A
set id = B.id
from A,B
where A.pid = B.pid
------解决方案--------------------
有A,B两表,A表中有Pid字段,B表中有ID,Pid字段,当A表中的Pid字段值与B表中的Pid字段值相同时,取B表中的ID值更新A表的Pid值。
比如:A.Pid = 234,B.id = 5,B.Pid = 234,更新后A.Pid = 5; 这个Update语名如何写?

--------------------
update A
set t1.Pid=t2.id
from A t1 join B t2 on t1.Pid=t2.Pid

------解决方案--------------------
update a set a.pid=b.id
from table1 a,table2 b
where a.pid=b.pid
------解决方案--------------------
update A
set t1.Pid=t2.id
from A t1 join B t2 on t1.Pid=t2.Pid