I have a datatable dt_Customers
which contains Customer_ID
, Email
and some other data. Some of the emails are duplicates in this data table, means they are repeating 2,3 or more times.
I have selected distinct emails in a list by using:
List<string> Email = dt_Customers.AsEnumerable().Select(r => r.Field<string>("Email")).Distinct().ToList();
Against these selected Emails which are in the list now. Is it possible to select Customer_ID
from the data table?
Or I have to write SQL query which will fetch the data from SQL Server database against selected email Ids in the list.