This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.
Hi ,
any one know how to do, like simple in SQL
Select user, Count(*) as submitted from table group by user
i want to achive in LINQ
i am storing in
IEnumerable
chartData = e.Result.ToList() // here i want apply condition grop by and count()
from t in dc.Table group t by user into tg select new { user = tg.key, submitted = tg.Count() }
Damien G's Linq-to-SQL "cheat sheet" is a great quick reference to common query constructs:
http://damieng.com/blog/2009/08/12/linq-to-sql-cheat-sheet
.
I am kind of new to LINQ, learning it myself, but I did find the following links that may be helpful in a google search.
http://knol.google.com/k/using-linq-to-sql#
http://stackoverflow.com/questions/448203/linq-to-sql-using-group-by-and-countdistinct
The first link has several examples in both VB and C#.
Maybe this would help, I would be interested in seeing the final linq code that works for you.
Later.
Ferlin.