在简单 linq 中使用 sum 时出现错误 [ORA-00979: 不是 GROUP BY 表达式]
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 )
}
);
我有那个代码,它是正确的。但每次我执行它时,它总是返回
error ORA-00979: not a GROUP BY expression.
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 )
}
);
I have that code, which is correct. but everytime I execute it, it always returns
error ORA-00979: not a GROUP BY expression.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
GROUP BY 子句不包含 SELECT 子句中的所有表达式。这是 SQL 中的标准错误。
例如,这是可以的:
但这不起作用:
在你的情况下,我猜你需要在 x.T_EMPLOYEE_ID 和 x.FINANCE_PERIOD_NAME 之后将 x.FREKUENSI 添加到 GroupBy 中。
。
The GROUP BY clause does not contain all the expressions in the SELECT clause. This is standard mistake in SQL.
For instance this is ok:
But this wont work:
In your case I guess you need to add x.FREKUENSI into GroupBy after x.T_EMPLOYEE_ID and x.FINANCE_PERIOD_NAME.
.