1
Select pm.ProductId, pm.Name, MIN(p.ListPrice) from SalesLT.ProductCategory pc, SalesLT.Product p, SalesLT.ProductModel pm
Where pm.ProductModelId = p.ProductModelId AND p.ProductCategoryID = pc.ProductCategoryID AND pc.ParentProductCategoryID = 2
Group By pm.ProductId, pm.Name

How do I translate this from SQL to linq?

I try this but I don't know how to select the MIN

var productList = from pc in db.ProductCategory
                  join p in db.Product on pc.ProductCategoryId equals p.ProductCategoryId
                  join pm in db.ProductModel on p.ProductModelId equals pm.ProductModelId
                  group pm by new { pm.ProductModelId, pm.Name } into g
                  select new { //i don't know what to do here now }
Huton
  • 23
  • 3
  • Perhaps my [SQL to LINQ Recipe](https://stackoverflow.com/questions/49245160/sql-to-linq-with-multiple-join-count-and-left-join/49245786#49245786) might help you? – NetMage Nov 30 '20 at 23:39

0 Answers0