I'm curious as to why my linq group by query returns 417 results whereas my SQL interpretation returns 419? I'm looking for duplicated emails from my list. I've checked out the result set and the two email addresses that are missing from the linq set both have accents. Does linq not recognize accents? Is there a workaround? The email field type is a nvarchar(100).
Let me know if you have any questions, Thanks in advance!
var listOfContacts = (from contacts in something
where contacts.Team.Id.Equals(TeamGuid) && !contacts.Email.Equals(null)
select new {contacts.Id, EmailAddress = contacts.Email.ToLower()}).ToList();
//Full Contact List; exact amount matches
var dupeEmailsList = listOfContacts
.GroupBy(x => x.EmailAddress)
.Where(g => g.Count() > 1)
.Select(y => y.Key)
.ToList();
//Returns 417
SELECT Email, COUNT(*)
FROM something
WHERE Team = 'Actual Team Guid Inserted Here'
GROUP BY Email
HAVING (COUNT(LOWER(Email)) > 1 AND Email IS NOT NULL)
ORDER BY Email
//Returns 419