Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 hours ago.
Improve this questionI have many to many relationship and "MyTable" is my relator Relational开发者_如何学C between "Stores" table and "Products" Table and I have a LINQ query to sum how many of product have I in store id but I want this SQL query:
user.MyTable.Where(i => i.StoreID == storeid).Sum(i => i.Count * user.Products.First(j => j.ProductID == i.ProductID).Sellprice);
SELECT SUM(i.Count * j.SellPrice)
FROM MyTable i
JOIN Products j ON j.ProductID = i.ProductID
WHERE i.StoreID = storeid;
could work.
精彩评论