Help with Linq expression - select from dynamic array

Hello,

I’m really struggling with comparing two datatables where the second datatable holds data in comma seperated values.

DT1:
Name | City
Unknown | Liverpool
Unknown | Aberdeen

DT2:
Name | City
John | East London, Liverpool, Manchester
Kay | Edinburgh, Aberdeen
Unknown | Southampton, West London

DT1 should hold refined data whereas DT2 is an untidy extract.

I need to be able to compare the two datatables and update DT1 with the relevant information.

The data is over 5000 rows & takes over two hours to process using a nested for each.

I already gather the information in DT2 city column in an array, but where i try to perform a linq query, my syntax isn’t right (as i’m only comparing the first item in the array rather than the full array:)
(From DT1 In dt1.AsEnumerable() From DT2 In dt2.AsEnumerable() Where DT1(1).toString.ToLower.Trim().equals(arr(0).ToString.toLower.Trim ) Select DT1).ToArray().Count > 0

Can anyone help please?

Hi @PJ_17,
On Forum you may find a lot of topics about comparing excel, csv and datatables. You can check also this topic for some examples: