0
餘米嘗試運行在2007年訪問這給訪問SQL查詢聚合函數
「試圖執行一個查詢,不包括指定表達式「輪(volumePass /音量* 100,2該錯誤的SQL )'作爲聚合函數的一部分「。
我卻由圓形在SQL語句中提到
組(volumePass /卷* 100,2)
SELECT s.[sub process name], Round(Avg(s.[TollGate FTEs]),2) AS TollGateFTEs,
Sum(w.volume) AS Volume,
Sum(Switch(w.TAT='Pass',w.Volume,w.TAT='Fail',0)) AS VolumePass,
Sum(IIf(w.[combined accuracy]='PASS',1,0)) AS AccuracyPass,
Sum(IIf(w.[combined accuracy]='',0,1)) AS TotalAccuracy,
Round((VolumePass/Volume)*100,2) AS TATPercentage,
Round((AccuracyPass/TotalAccuracy)*100,2) AS AccuracyPercentage,
Format(w.[reporting month],'mmm-yy') AS [Rep Month] FROM Work_Log1 AS w,
[sub process] AS s WHERE w.[sub process] In (SELECT s.[sub_process_id] FROM
[Sub Process] s,
[process mapping] m where m.[process name] like 'Accounting Control%'
and s.[mapped to process id] = m.[mapping id]) And w.[sub process]=[s].[sub_process_id]
AND (w.[Activity_start_date] Between #06/01/2012# And #06/15/2012#)
AND ([w].[sla applicable]=1 Or 0 Or '') and
(w.[status] Like 'Complete%') group BY Format(w.[reporting month],'mmm-yy'),
s.[sub process name], (Round((VolumePass/Volume)*100,2));
如果是,它不能正確地回暖。
給別名「TATPercentage」仍然不起作用,並給出相同的錯誤。
此查詢在訪問查詢設計器中工作良好,但不能用vba中的sql運行。
更新:
得到它使用DAO引擎VBA。與ADODB引擎
我的答案只是修復他的小組按問題......但是你的回答提出了一個有效的問題 - 他真的想要根據這個百分比或者構成該價值的價值進行分組。 –