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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -