join groups without duplicates