or using a FULL JOIN:WITH UAccountsAS( SELECT DISTINCT AccountId FROM Accounts)SELECT COALESCE(U.AccountId, A.AccountId) AS AccountId ,COALESCE(I.SecurityId, A.SecurityId) AS SecurityId ,CASE WHEN A.AccountId IS NULL THEN 'Only in Index' WHEN U.AccountId IS NULL THEN 'Only in Account' ELSE 'Matched' END AS MatchStatusFROM UAccounts U CROSS JOIN [Index] I FULL JOIN Accounts A ON U.AccountId = A.AccountId AND I.SecurityId = A.SecurityIdORDER BY AccountId, SecurityId