SELECT b.GroupName, c.[DisplayName]
FROM dbo.BASUserGroupMembershipV a left join dbo.BASGroupNamesV b on a.[GroupId] = b.[GroupId]
left join dbo.UserConfig c on a.UserConfigId = c.[Id]
Where a.GroupId = '4'
UNION
SELECT b.GroupName, c.[DisplayName]
FROM dbo.BASUserGroupMembershipV a left join dbo.BASGroupNamesV b on a.[GroupId] = b.[GroupId]
left join dbo.UserConfig c on a.UserConfigId = c.[Id]
Where a.GroupId = '5'
FROM dbo.BASUserGroupMembershipV a left join dbo.BASGroupNamesV b on a.[GroupId] = b.[GroupId]
left join dbo.UserConfig c on a.UserConfigId = c.[Id]
Where a.GroupId = '4'
UNION
SELECT b.GroupName, c.[DisplayName]
FROM dbo.BASUserGroupMembershipV a left join dbo.BASGroupNamesV b on a.[GroupId] = b.[GroupId]
left join dbo.UserConfig c on a.UserConfigId = c.[Id]
Where a.GroupId = '5'