Group By Multiple Columns - LINQ

Posted by Nev_Rahd on Stack Overflow See other posts from Stack Overflow or by Nev_Rahd
Published on 2009-05-11T07:24:39Z Indexed on 2010/04/11 11:23 UTC
Read the original article Hit count: 237

Filed under:

How can I do GroupBy Multiple Columns in LINQ

Something as in SQL :

SELECT * FROM <TableName> GROUP BY <Column1>,<Column2>

How Can i convert below to LINQ

     QuantityBreakdown
(
	MaterialID int,
	ProductID int,
	Quantity float
)

     INSERT INTO @QuantityBreakdown (MaterialID, ProductID, Quantity)
SELECT MaterialID, ProductID, SUM(Quantity)
FROM @Transactions
GROUP BY MaterialID, ProductID

Thanks

© Stack Overflow or respective owner

Related posts about LINQ