2011-08-12 22 views
0
 var dataTotalPotongan = (from x in absentContext.V_DETAIL_PELANGGARANs 
           group x by 
           new 
           { 
            x.T_EMPLOYEE_ID, 
            x.FINANCE_PERIOD_NAME 
           } 
            into gruopedData 
            select 
            new 
            { 
             gruopedData.Key.T_EMPLOYEE_ID, 
             periode = Convert.ToDateTime(gruopedData.Key.FINANCE_PERIOD_NAME), 
             jumlah = gruopedData.Max (x => x.FREKUENSI) 
            } 

          ); 

我有那段代碼,它是正確的。但每次我執行它,它總是返回錯誤[ORA-00979:不是GROUP BY表達式]當在簡單LINQ中使用總和時

error ORA-00979: not a GROUP BY expression. 

回答

1

GROUP BY子句中不包含SELECT子句中的所有表達式。這是SQL中的標準錯誤。

例如這是確定:

SELECT Customer,OrderDate,SUM(OrderPrice) 
FROM Orders 
GROUP BY Customer,OrderDate 

但是,這不會工作:

SELECT Customer,OrderDate, OrderPrice 
FROM Orders 
GROUP BY Customer,OrderDate 

在你的情況我猜你需要x.T_EMPLOYEE_ID和X後x.FREKUENSI加入到的GroupBy。 FINANCE_PERIOD_NAME。