开发者

Assistance converting LINQ code to SQL Query [closed]

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜