3

以下のlinqを実行できません。

   var items(  from p in Patients 
    join q in MURWorksheets on p.PatientId equals q.PatientId into step1
    from s in step1.DefaultIfEmpty()
    join t in MURWorksheetAnswers on s.MURWorksheetId equals t.MURWorksheetId into step2


    from s2 in step2.DefaultIfEmpty()

    select new {p.FirstName , Date = (s.MURDate == null ? DateTime.Now.Date : s.MURDate),
    s2.MURQuestionnaireId,s2.MURExpctedAnswersId}).ToList();

参照用に同じSQLを次に示します。

select a.FirstName,b.MURDate,c.MURQuestionnaireId,c.MURWorksheetAnswersID from Patients as a
left join MURWorksheet as b on a.PatientId = b.PatientId
left join MURWorksheetAnswers as c on b.MURWorksheetId = c.MURWorksheetId
4

1 に答える 1