INSERT INTO users_groups (users_userId, groups_groupId)
SELECT u.userId, g.groupId
FROM users u
JOIN uGroups g ON g.groupName = 'editConfig'
WHERE u.userName = 'customer'
  AND NOT EXISTS (
      SELECT 1
      FROM users_groups ug
      WHERE ug.users_userId = u.userId
        AND ug.groups_groupId = g.groupId
  );

INSERT INTO users_groups (users_userId, groups_groupId)
SELECT u.userId, g.groupId
FROM users u
JOIN uGroups g ON g.groupName = 'editCustomGraphics'
WHERE u.userName = 'customer'
  AND NOT EXISTS (
      SELECT 1
      FROM users_groups ug
      WHERE ug.users_userId = u.userId
        AND ug.groups_groupId = g.groupId
  );

INSERT INTO users_groups (users_userId, groups_groupId)
SELECT u.userId, g.groupId
FROM users u
JOIN uGroups g ON g.groupName = 'editPromotionScreen'
WHERE u.userName = 'customer'
  AND NOT EXISTS (
      SELECT 1
      FROM users_groups ug
      WHERE ug.users_userId = u.userId
        AND ug.groups_groupId = g.groupId
  );