任何知道此事的人都请帮忙,
如何在Linq to Entities中重写以下SQL存储过程?
ALTER PROCEDURE [dbo].[SampleSP]
AS BEGIN
;with CTE_MyData(Col1, Col2,Col3 ) AS
(
SELECT DC.Name, DT.Name, RD.Col3 FROM MyData RD
INNER JOIN FoodType DT ON RD.FoodId = DT.FoodId
INNER JOIN FoodCategory DC ON DT.FoodCategoryId = DC.FoodCategoryId
)
SELECT Col1,
CASE
WHEN GROUPING(Col2) = '' THEN Col2
ELSE Col1
END [Food Column],
SUM(Col3) AS Col3
FROM CTE_MyData
GROUP BY Col1, Col2 WITH ROLLUP
HAVING GROUPING(Col1) = 0
END