project table:
Id, DeptId, Year, Name, Level
Id = 1, DeptId = 1, Year = 2000, Name = \"ABC\", Level = 1 Id = 2, DeptId = 1, Year = 2001, Name = \"ABC1\",
var query= from p in context.Projects group p by p.DeptId into grp select grp.Where(x => x.Year <= 2001) .OrderByDescending(x => x.Year) .FirstOrDefault();