Click here to Skip to main content
15,896,726 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Event_id. companyid Branch Id Effective date ASSIGNED BY STATUS
1 51 1 May-05-2014 vinsha completed
2 51 2 May-07-2014 Vinisha completed
3 51 1 May-05-2014 vinisha completed
4 51 1 May-05-2014 vinisha completed


here i have only companyid i want event id count based on branch id.. using linq to sql
Posted

1 solution

like below
C#
var result =
       YourTable.GroupBy(e=>e.BranchId)
                .Select(g=>new{BranchId =g.Key, Count =g.Count()})
                .ToList();
 
Share this answer
 
Comments
Member 9893329 9-May-14 22:57pm    
thank u, but i wnt branch name from another table based on branch_id from same query

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900