我有两张桌子
t1
id | value
1 | -
2 | -
t2
parent_id | p_value
1 | 254
2 | 124
我想将列p_value
从 t2 复制到 t1 中parent_id = id
我有两张桌子
t1
id | value
1 | -
2 | -
t2
parent_id | p_value
1 | 254
2 | 124
我想将列p_value
从 t2 复制到 t1 中parent_id = id
update t1, t2 set t1.value = t2.p_value where t1.id=t2.parent_id
尝试这个:
Update t1, t2 set t1.value = t2.p_value where t1.id = t2.parent_id;
尝试这个
update t1 join t2 on t2.parent_id= t1.id set t1.value = t2.p_value