using System.Collections.Generic;
public static void Main()
List<SickLeaveRequestForms> db = new List<SickLeaveRequestForms> { new SickLeaveRequestForms { EmployeeID = 1, MonthOfHoliday = "January", MonthOfHolidayInt = 1, SickLeaveTaken=1},
new SickLeaveRequestForms { EmployeeID = 2, MonthOfHoliday = "March", MonthOfHolidayInt = 3, SickLeaveTaken=1},
new SickLeaveRequestForms { EmployeeID = 1, MonthOfHoliday = "February", MonthOfHolidayInt = 2, SickLeaveTaken=1}, new SickLeaveRequestForms { EmployeeID = 2, MonthOfHoliday = "February", MonthOfHolidayInt = 2, SickLeaveTaken=1},
new SickLeaveRequestForms { EmployeeID = 1, MonthOfHoliday = "March", MonthOfHolidayInt = 3, SickLeaveTaken=1},
new SickLeaveRequestForms { EmployeeID = 2, MonthOfHoliday = "January", MonthOfHolidayInt = 1, SickLeaveTaken=1},
new SickLeaveRequestForms { EmployeeID = 2, MonthOfHoliday = "January", MonthOfHolidayInt = 1, SickLeaveTaken=1},
var result = (from r in db
group r by r.MonthOfHolidayInt into g
select new { Value = g.Key, Count1 = g.Sum(h => h.SickLeaveTaken), MonthName = g.Select(d => d.MonthOfHoliday), EmployeeId = g.Select(e => e.EmployeeID) })
foreach(var d in r.MonthName)
Console.WriteLine("Value:" + r.Value + " Count1: " + r.Count1 + " MonthName: " + d);
public class SickLeaveRequestForms
public int EmployeeID {get;set;}
public string MonthOfHoliday {get;set;}
public int MonthOfHolidayInt {get;set;}
public int SickLeaveTaken {get;set;}