LINQ2SQL differs in quantity and sorting

I have a list: a,b,c

Using LINQ2SQL I need a list: a,b,count(a,b) sorted by a,b where intArray.Contains(c)

The conclusion may be the group a, this is not a problem.

Explain a little further:
SELECT a,b,c FROM TABLE WHERE c=1give me a list a, b, c. I don't care about c, but I'm interested in a separate list of a, b and count a, b.

Well, not the best explanation. I hope you understand. Sample data:

The data
1,1,1
0,0,0
0,1,0
0,1,1
0.2.0
0.3.5
0,3,6
0,3,7

Should output
0,0,1
0,1,2
0,2,1
0,3,3
1,1,1
+3
source share
1 answer
from data in context.Data
group data by new
{
  data.A,
  data.B,
} into dg
orderby dg.Key.A, dg.Key.B
select new
{
  dg.Key.A,
  dg.Key.B,
  dg.Count()
}
0
source

All Articles