Reputation: 21066
table 1(ob): name,address
table 2(address): dname,addr
I need to update ob.address
with address.addr
when ob.name=address.dname
. Can anyone help to get better results because I'm using following command which leads system halt.
UPDATE ob LEFT JOIN address ON ob.name =address.dname SET ob.address=address.addr;
Upvotes: 0
Views: 122
Reputation: 3845
This should do it:
update ob
set address = address_table.addr
where ob.name = address_table.dname
EDIT: Advice: use a better name for Table 2 than address. Maybe TBL_ADDRESS? In my above example I used address_table.
Upvotes: 2
Reputation: 882571
UPDATE ob
SET ob.address = address.addr
WHERE ob.name = address.dname
Upvotes: 0