score:2

Accepted answer

do something like this : (Update column name as per yours)

var query = (from c in TestResult
        join tbl2 in TestResultRelated on c.ID equals tbl2.TestResult 
        where c.USER_LOGIN_NAME = 'emilwkj' and tbl2.DATA != ''
        orderby tbl2.DATA
        group tbl2 by tbl2.DATA into g
        select new 
        {
            Id = g.Key.Id,
            Name = g.Key.Name,
            TestResultRelated = g
        })
        .Distinct()   //.Distinct(x=>x.someColumn) 
        .OrderByDescending(x => x.date);
        .Take(10)

score:0

As we understand you are using efcore and DbContext heaving TestResult and TestResultRelated table.

Here is the code of problem that we understand from your question.

var db=new DbContext();
var result = (from a in db.TestResult
             join b in db.TestResultRelated on a.ID equals b.TestResult
             where b.PATH == "TestResultRelatedAdditionalData.SoftwareVersion"
             & a.USER_LOGIN_NAME == "emilwkj" & b.DATA!=" "
             group b by b.DATA into item
             orderby item.Max(e=>e.START_DATE_TIME) descending
             select item)
             .Take(10);

Related Articles