Can someone please show me both linq to SQL and linq to IQueryable/IEnumerable formats for this SQL query.
SELECT P.[Name], COUNT(S.[ProductId]) AS [Quantity], SUM(PP.[Value]) FROM [Product] P
INNER JOIN [ProductPrice] PP ON P.[Id] = PP.[ProductId] AND pp.[OperationType] = 2
LEFT OUTER JOIN [StorageItem] S ON P.[Id] = S.[ProductId]
LEFT JOIN [Order] O ON O.Id = S.[CollectionOrderId]
GROUP BY P.[Name]
ORDER BY Quantity DESC
I absolutely have tried and tried and tried. I can't get the SQL output from my linq to match the above.
I'm looking for someone to translate the above in both formats:
Linq to IQueryable/IEnumerable
var query = context.Products.Join(...)
Linq to SQL
var query = (from p in context.Products join pp in context.ProductPrices...)
Thanks for your help
Go to the complete details ...