Pivot top level collection

May 10, 2013 at 1:46 PM
Edited May 10, 2013 at 1:51 PM
Hi, the example https://linqlib.codeplex.com/wikipage?title=Pivot seems to be more about flattening a hierarchy than about pure pivot.

I have a top level collection, no child collection, that I want to pivot. Does this library's pivot extension handle this?

For example:

Col 1 | Col 2 | Col 3
X | A | 5
X | A | 10
X | A | 7
X | B | 4
X | B | 8
Y ...
Z ...
... (more rows)

where there are N different values in Col 1.

using sum() as the aggregation would become

Col 1 | Col A | Col B | ... | Col N
X | 22 | 12 | ... | sum for N values
Y ...
Z ...

Consider N fixed if that helps, although my ultimate scenario requires N to vary from one invocation to the next.

Thanks