Translation of a Sql Statement to Linq
can sombody Help me in convert this SQL Statement into Linq
select Teilenr, isnull( (Select Sum(Menge) from bedarf x where x.kz= 'B' and x.teilenr= bedarf.Teilenr and active='T'),0) - isnull((Select Sum(Menge) from bedarf x where x.kz='D' and x.teilenr= bedarf.Teilenr and active='T' ),0) From bedarf where Active= 'T' group by Teilenr
select Teilenr, isnull( (Select Sum(Menge) from bedarf x where x.kz= 'B' and x.teilenr= bedarf.Teilenr and active='T'),0) - isnull((Select Sum(Menge) from bedarf x where x.kz='D' and x.teilenr= bedarf.Teilenr and active='T' ),0) From bedarf where Active= 'T' group by Teilenr
Comments
Let us know what you've come up with and we can help you from there.