Retrieve a result set grouped by the month/year combination and the number of records that appear within that month/year, done in LINQ?
Πέμπτη, 23 Φεβρουαρίου 2012
var grouped = (from p in posts
group p by new { month = p.Create.Month,year= p.Create.Year } into d
select new { dt = string.Format("{0}/{1}",d.Key.month,d.Key.year), count = d.Count()}).OrderByDescending (g => g.dt)
source: http://stackoverflow.com/questions/762899/linq-group-by-month-and-year-within-a-datetime-field



