update groupuser as g1 join groupuser as g2 on (g1.user_id=1 and g2.user_id = 2) or(g1.user_id = 2 and g2.user_id=1) set g1.group_id = g2.group_id,g2.group_id=g1.group_id;