Will Web 3.0 Replace Web 2.0?
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forum guidelines
saan mughal
0
12
0
Sql Statement to Linq
Mar 16 2021 12:55 AM
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)
Reply
Answers (
5
)
linq data from sql table
Getting the previous row value in SQL SERVER