title: LINQ - Left Join, Group By, Sum,
body: <p>I have this sql code:</p>
  
  <pre><code>select A.Recurso_Id, sum(case when B.cita_id is null then 0 else 1 end) as Total_Eventos,
  a.Recurso_Nombre, a.Recurso_Email,a.Recurso_Activo
  from Agenda_Recurso a left join Agenda_Cita  B
  on A.Recurso_Id=B.Recurso_Id 
  group by A.Recurso_Id,a.Recurso_Nombre, a.Recurso_Email,a.Recurso_Activo
  </code></pre>
  
  <p>And, I need to traslate to LinQ, actually I have this code:</p>
  
  <pre><code>List&lt;Select&gt; _ListaSelect = (from R in _LstRecursos
                                 join C in _LstCitas
                                 on R.Id equals C.Recurso_Id
                                 group R by new {C.Recurso_Id, R.Nombre} into total
                                 select new Select()
                                 { 
                                     Cantidad_Eventos = total.Sum(R=&gt; R.Id), 
                                     Recurso_Nombre= total.Max(R=&gt; R.Nombre),
                                     Recurso_Email=total.Max(R=&gt;R.Email),
                                     Recurso_Activo=total.Max(R=&gt;R.Activo),
                                     Id_Recurso=total.Max(R=&gt;R.Id)
                                 }).ToList();
  </code></pre>
  
  <p>But, it does not work. Can you help me?</p>