update gw2_roster_wvw
set user_id =
(select user_id FROM xf_user_field_value where gw2_roster_wvw.member = xf_user_field_value.field_value);
这是我的查询,用于使用实际论坛数据库中的用户ID更新gw2_roster_wvw
我现在要做的是获取此更新的表,然后更新
xf_user_field_value
xf_user_field_value包含3个字段:
user_id
field_id
field_value
这是示例输出:
select * from xf_user_field_value where user_id = "1";
+---------+-------------+--------------------------------------------------+
| user_id | field_id | field_value |
+---------+-------------+--------------------------------------------------+
| 1 | facebook | |
| 1 | gw2_account | xxxxxx.4725 |
| 1 | gw2_groups | a:2:{s:3:"wvw";s:3:"wvw";s:4:"Yank";s:4:"Yank";} |
| 1 | gw2_rank | |
| 1 | skype | |
| 1 | twitter | |
+---------+-------------+--------------------------------------------------+
我在想什么,我需要做这样的事情:
update xf_user_field_value
set field_value =
(select rank FROM gw2_roster_wvw where xf_user_field_value.user_id = gw2_roster_wvw.user_id)
where field_id = "gw2_rank";
是否有更好/更简便的方法来做到这一点?