开发者

Assistance converting LINQ code to SQL Query [closed]

开发者 https://www.devze.com 2022-12-07 18:23 出处:网络
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post.
Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 2 hours ago.

Improve this question

I 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消