I am trying to convert the the following SQL statement into a linq query but for some reason I cannot get it to work!!
SELECT o.ITEMID, COUNT(o.ITEMID) AS COUNT, MAX(i.QUANTITY) AS Quantity
FROM ORDERS AS o LEFT OUTER JOIN
INVENTORY AS i ON o.ITEMID = i.ITEMID
GROUP BY o.ITEMID
I found this link, somebody having a similar problem but I cant seem to apply this to what i need.
thanks for all your help.
This is the code i have so far
Dim castleavailability = _
From o In orders _
From i In inventorys _
Where (x >= o.ITEMID = i.ITEMID)
Group New With {o, i} By o.ITEMID Into oi()
Select New With {.ItemId = oi.Key, .Count = oi.Select(y >= y.o.ItemId).Count(), .Quantity = oi.Select(y >= y.i.Quantity).Max()}
the error I am getting now is "Definition of method 'oi' is not accessible in this context." referring to the "group new with" line. Any ideas on how to resolve this
Many Thanks