group by [modified]
-
I have a List<CapturedWord> CapturedWord -StartIndex -EndIndex -String I can do a group by StartIndex which gives me: startindexkey -- List<CapturedWord> startindexkey -- List<CapturedWord> startindexkey -- List<CapturedWord>
var groups = (from w in words group w by w.StartIndex into g select new { StartIndex = g.Key, Words = g }).ToList();
SELECT * FROM CapturedWord AS c1id StartIndex EndIndex Word ----------- ----------- ----------- 1 0 6 product 2 1 3 rod 4 3 6 duct 5 0 7 products 6 7 14 specific 7 11 12 if 8 15 16 at 9 15 23 attribute 10 15 24 attributes SELECT c1.StartIndex, COUNT(c1.StartIndex) as cnt FROM CapturedWord AS c1 GROUP BY c1.StartIndex StartIndex cnt ----------- ----------- 0 2 1 1 3 1 7 1 11 1 15 3
I would like instead a group by that provides these numbers and accumulated stringscnt ----------- 4 -- product, products, rod, duct 2 -- specific, if 3 -- at, attribute, attributes
modified on Saturday, July 25, 2009 9:53 PM