dbo.edp_GetNumDaysInMonth()
は、ユーザー定義の関数です。それは集計 関数またはGROUP BY句に含まれていないため、メッセージ8120グループ化および集計(ミリ秒単位)SQL
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)
、レベル16、状態1、行1列「a.enddatetime」は、選択リストに 無効です。
month(a.enddatetime)
または- フィールドの集計関数
の内側にあなたはあなたが持っているので、
a.enddatetime
を使用している:あなたはので、あなたの選択にあなたが使用する必要がありmonth(a.enddatetime)
によってグループ化されている