Hi all
In the northwind database, on the orders table, How would I get back
the the number of items that exist with the following condition:
ShipVia=1
ShipVia=2
ShipVia=3
I want to do this in one database hit
I have tried:
Northwindcontex t c=new Northwindcontex t();
var (from x in c.Orders
let total1=c.Orders .Count(y=>y.Shi pVia=1)
let total2=c.Orders .Count(y=>y.Shi pVia=2)
let total3=c.Orders .Count(y=>y.Shi pVia=3)
).SingleOrDefau lt();
but this doesnt work - I know why because I get an entry for every row
in the orders table, but how do use the Let command so that I get just
one row back?
Many thanks
In the northwind database, on the orders table, How would I get back
the the number of items that exist with the following condition:
ShipVia=1
ShipVia=2
ShipVia=3
I want to do this in one database hit
I have tried:
Northwindcontex t c=new Northwindcontex t();
var (from x in c.Orders
let total1=c.Orders .Count(y=>y.Shi pVia=1)
let total2=c.Orders .Count(y=>y.Shi pVia=2)
let total3=c.Orders .Count(y=>y.Shi pVia=3)
).SingleOrDefau lt();
but this doesnt work - I know why because I get an entry for every row
in the orders table, but how do use the Let command so that I get just
one row back?
Many thanks
Comment