I have a problem creating the following SQL Statement using LINQ & C#
    select c.IDAddenda, c.Descripcion
      from CatAddendas c 
right join EmpresaAddenda e on e.IDAddenda = c.IDAddenda
     where e.rfc = 'SUL010720JN8'
  order by c.IDAddenda asc
I got this:
public IEnumerable<CatAddenda> TraeAddendas(string rfc)
{
    DataClasses1DataContext dc = new DataClasses1DataContext(...);
    return (from adds in dc.EmpresaAddendas
            cats.IDAddenda    into joined 
            where adds.RFC == rfc
            select adds.CatAddenda);
}
This is not doing a right join, so any ideas?
 var RightJoin = from adds in dc.EmpresaAddendas
                 join cats in CatAddendas 
                     on adds.IDAddenda equals cats.IDAddenda into joined
                 from cats in joined.DefaultIfEmpty()
                 select new
                 {
                     Id = cats.IDAddenda,
                     Description = cats.Descripcion 
                 };
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With