Reputation: 1633
I have two tables
t1
id | value
1 | -
2 | -
t2
parent_id | p_value
1 | 254
2 | 124
I want to copy the column p_value
from t2 into t1 where parent_id = id
Upvotes: 2
Views: 2412
Reputation: 20840
Try this:
Update t1, t2 set t1.value = t2.p_value where t1.id = t2.parent_id;
Upvotes: 1
Reputation: 8058
Try this
update t1 join t2 on t2.parent_id= t1.id set t1.value = t2.p_value
Upvotes: 0