I
Ilyas
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:
Northwindcontext c=new Northwindcontext();
var (from x in c.Orders
let total1=c.Orders.Count(y=>y.ShipVia=1)
let total2=c.Orders.Count(y=>y.ShipVia=2)
let total3=c.Orders.Count(y=>y.ShipVia=3)
).SingleOrDefault();
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:
Northwindcontext c=new Northwindcontext();
var (from x in c.Orders
let total1=c.Orders.Count(y=>y.ShipVia=1)
let total2=c.Orders.Count(y=>y.ShipVia=2)
let total3=c.Orders.Count(y=>y.ShipVia=3)
).SingleOrDefault();
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