我有3张桌子:
users, user_profile, plus
我想将表用户与 user_profile 合并,并将缺失值填入表加。参考文献标有颜色的图像。
plus
表中的唯一键是email
列。
表和参考文献:
答案 0 :(得分:0)
UPDATE plus AS p
JOIN users AS u ON p.email = u.email
JOIN user_profile AS up ON up.user_id = u.id
SET p.reg_date = u.reg_date, p.nickname = up.nickname, p.name = up.name,
p.surname = up.surname, p.birthday = up.birthday, p.gender = up.gender