![](/img/trans.png)
[英]Copy Column Value from One table into Another Matching IDs - SQLite
[英]Copy Column Value from One table into Another Matching IDs
我有两张桌子
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.