How to frame linq query with COUNT, GROUP BY and select statement? -
i have form linq query select, count , select statement
my table looks
date name 2015-04-25 xxy 2015-04-25 pap 2015-04-25 sms 2014-07-12 bljoe 2014-07-12 olk
i want result similar
date count 2015-04-25 3 2014-07-12 2
my sql query :
select t.date, count(k.name) table t group t.date
but dont know how linq query should :
i tried this. returned exception
var result = (from ka in _db.table group t new {t.date} g select new { date = g.key, count = g.firstordefault().name.count() }).tolist();
Comments
Post a Comment