I have 2 datasets ds1 and ds2 ds1 contains valid values used in ds2 for e.g. ds1 contains subject table containing Maths, Science, History. ds2 contains Student table Student table contains Subject column. ds2->Student->Subject values should be present in ds->subject table.
How to implement this type of validation in effective way. I don’t want to iterate through each row and column of student table.
e.g.
Students Table
Name Subject Status
Peter Maths Fail
George Science Pass
Joe IT Pass
Roger History Other
Subjects Table
Subject
Maths
Science
Maths
History
Status Table
Status
Pass
Fail
Now I want to validate the data in Students Table against Subject table Check if the Subject is present in Subjects table or not. Here I want row Joe IT since IT is not present in Subjects table it is invalid.
Similarly , I need to check Students table data with Status table.
Expected Output
Subject IT
Status Other
I want LINQ query.
A simple approach:
Assuming Subject is PK in the Subject ds.