table 1 table 2
+---------+------------+ +---------+------------+
| post_id | meta_value | | ID | post_title |
+---------|------------+ +---------|------------+
| 1 | value_a | | 1 | title_abc |
+---------|------------+ +---------|------------+
| 2 | value_b | | 2 | title_xyh |
+---------|------------+ +---------|------------+
| 3 | value_c | | 3 | title_jer |
+---------|------------+ +---------|------------+
| ..... | ......... | | ..... | ....... |
+---------|------------+ +---------|------------+
| 999 | value_xyzw | | 999 | title_bhw |
+---------|------------+ +---------|------------+
我有2张桌子。我尝试post_title
用meta_value
{表1)替换(表2)中的记录。
例子:
value_a
代替 title_abc
value_b
代替 title_xyh
value_c
代替 title_jer
............
等等
谢谢!
您想要update
带有的join
:
update table1 t1 join
table2 t2
on t1.post_id = t2.id
set t1.meta_value = t2.post_title;
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句