我正在尝试将一个非常简单的linq表格查询转换为交叉表。
dim q results
Zone Cube QTY
100 LARGE 19
100 MEDIUM 4
100 SMALL 2
100 TINY 1
200 TINY 9
200 LARGE 1
200 TINY 2
linq to crosstab
Dim b = From f In (From x In q Group x By x.Zone Into Group) _
Let MEDIUM As Object = (From r In f.Group Where _
r.Cube = "MEDIUM" Select r.QTY).Sum _
Let SMALL As Object = (From r In f.Group Where _
r.Cube = "SMALL" Select r.QTY).Sum _
Select New With {f.Zone ,SMALL,MEDIUM}
这应该给我一个交叉表,但是我只得到组列,并且对象列没有显示出来。 我尝试了不同的东西,但我被卡住了。有任何想法吗?