Hi Everyone,
I am very new to Linq, i have a SQL statement which i want to convert to Linq but I am struggling with it, I will really appreciate any help,
Sql statement:
select cat_name, cat_id, count(pro_fk_cat_id) as count
from
tbl_category c left join tbl_product p on c.cat_id = p.pro_fk_cat_id
group by
cat_name,
cat_id,
pro_fk_cat_id
Linq:
var results = from d in this.objDB.tbl_category
from m in this.objDB.tbl_Product
.Where(m => m.pro_fk_cat_id == d.cat_id)
group (d.cat_id,d.cat_name,m.pro_fk_cat_id)