I am new to LINQ and have become stumped on the translating the following code. I am currently writing a front end for a SQL database. I have a SQL view that gives a list of identity values (electrolyte_id). The list is grouped by the electrolyte identity value and filtered by the maximum date for each process tanks identity value (process_tanks_id) in the electrolyte_max_date (view). below is the sql query.
SELECT electrolyte.electrolyte_id, electrolyte.process_tanks_id, electrolyte.date_active
FROM electrolyte_max_date INNER JOIN electrolyte ON
electrolyte_max_date.max_date = dbo.electrolyte.date_active AND
electrolyte_max_date.process_tanks_id = electrolyte.process_tanks_id
I have been able to translate the electrolyte_max_date query in LINQ. Below is the code:
var filter_electrolyte_list = from tbl_electrolyte in _ds.electrolyte.AsEnumerable()
group tbl_electrolyte by
tbl_electrolyte.process_tanks_id into tankgroup
select new
{
tank = tankgroup.Key,
maxdate = tankgroup.Max(tbl_electrolyte =>
tbl_electrolyte.date_active)
};
My question is: How do I join the filter_electrolyte_list LINQ query to the electrolyte table in another LINQ query? I need to replicate the same results that i get in the SQL View.
Thanks in advance for any help. Jonathan