i have 2 tables (product , review)
product
productid productname imagepath categoryid
review
reviewid productid reviewtext
i want result set show productname, imagepath , total reviews product.
i write sql query this
select productname, imagepath,count(rw.productid) totalreview product pr join review rw on pr.productid = rw.productid pr.categoryid=1 group productname, imagepath please help.
this ef linq code query
var query = p in db.products p.categoryid = 1 select new { name = p.productname, imagepath = p.imagepath, totalreviews = p.reviews.count() }; var results = query.tolist();
Comments
Post a Comment