I have two tables in my data entity model accessed by StaffDB.
Rating1 (automatic to avoid conflict with table name also of rating)
These are linked by StaffID.
I am trying to select each staff member using their most recent rating date so that I do not get duplicate output as this is then categorised on the web page it outputs.
I have found some code online and adapted it to get the following:
var LatestEmployeeRatings = from s in StaffDB.Staffs join r in StaffDB.Ratings on s.StaffID equals r.StaffID group s by s.StaffID into g select g.OrderByDescending(r => r.Date).First();
However this code was for using one table not two and therefore I think im going wrong in lines 4 and 5 as line 5 has an error as r.Date does not exist at this point :(
Can anyone enlighten me on how I need to further adapt this to work?