最佳答案
如何在LINQ中执行GroupBy多列
类似于SQL:
SELECT * FROM <TableName> GROUP BY <Column1>,<Column2>
如何将其转换为LINQ:
QuantityBreakdown(MaterialID int,ProductID int,Quantity float)
INSERT INTO @QuantityBreakdown (MaterialID, ProductID, Quantity)SELECT MaterialID, ProductID, SUM(Quantity)FROM @TransactionsGROUP BY MaterialID, ProductID