【发布时间】:2011-10-21 10:56:53
【问题描述】:
dbo.edp_GetNumDaysInMonth() 是用户定义的函数。
select
month(a.enddatetime),
cast(((dbo.edp_GetNumDaysInMonth(a.enddatetime)) * 22.5 - (isnull(sum(a.delayhr),0)/3600.00)) / count(a.machine_no) as decimal(11,2)) as MTBF
from mro_maint a
left join mro_machine b on a.machine_no = b.machine_no
where (b.section = 'TRANSMISSION' OR b.section = 'EATON LINE' OR b.section = 'TOYOTA')
group by month(a.enddatetime)
消息 8120,级别 16,状态 1,第 1 行列 'a.enddatetime' 无效 在选择列表中,因为它不包含在任一聚合中 函数或 GROUP BY 子句。
【问题讨论】: