Executing query

akhazendar05

New member
Joined
Jul 11, 2012
Messages
2
Programming Experience
1-3
SELECT [Reporting Extract Ad Hoc].RITM_ID, [Gary Actuals].[BIRT Number], Sum([Gary Actuals].[Actual Hours]) AS [SumOfActual Hours], First([Reporting Extract Ad Hoc].RITM_ACTUAL_START_DATE) AS FirstOfRITM_ACTUAL_START_DATE, Last([Reporting Extract Ad Hoc].APPROVED_ACTUAL) AS LastOfAPPROVED_ACTUAL, Last([Reporting Extract Ad Hoc].DELIVERED_ACTUAL) AS LastOfDELIVERED_ACTUAL, Last([Reporting Extract Ad Hoc].ACTUAL_HOURS) AS LastOfACTUAL_HOURS, WorkingDays3(APPROVED_ACTUAL,LastOfDELIVERED_ACTUAL) AS Networkingdays
FROM [Gary Actuals] INNER JOIN [Reporting Extract Ad Hoc] ON [Gary Actuals].[BIRT Number]=[Reporting Extract Ad Hoc].RITM_ID
GROUP BY [Reporting Extract Ad Hoc].RITM_ID, [Gary Actuals].[BIRT Number], WorkingDays3([APPROVED_ACTUAL],[LastOfDELIVERED_ACTUAL])
ORDER BY [Reporting Extract Ad Hoc].RITM_ID;

This query did not have this function in there, so I added it and when I tried to run the query, it gave this error:

you tried to execute a query that does include the specified expressionWorkingDays3(APPROVED_ACTUAL,LastOfDELIVERED_ACTUAL) AS Networkingdays as a part of an aggregate function.

I have a table called Holidays, and the code for WorkingDays3 as well.
 
The problem seems to be not in the highlighted part, but in the GROUP BY clause. Do you actually need to include your function there? It seems to me the function should be called only once...
 
So I delete the bold statement and I go ahead and run it, and gives me this error:

the select statement includes a reserved word or an argument name that is misspelled or missing, or punctuation is incorrect.

then i click Ok, it automatically highlights the word FROM.

SELECT [Reporting Extract Ad Hoc].RITM_ID, [Gary Actuals].[BIRT Number], Sum([Gary Actuals].[Actual Hours]) AS [SumOfActual Hours], First([Reporting Extract Ad Hoc].RITM_ACTUAL_START_DATE) AS FirstOfRITM_ACTUAL_START_DATE, Last([Reporting Extract Ad Hoc].APPROVED_ACTUAL) AS LastOfAPPROVED_ACTUAL, Last([Reporting Extract Ad Hoc].DELIVERED_ACTUAL) AS LastOfDELIVERED_ACTUAL, Last([Reporting Extract Ad Hoc].ACTUAL_HOURS) AS LastOfACTUAL_HOURS,
FROM [Gary Actuals] INNER JOIN [Reporting Extract Ad Hoc] ON [Gary Actuals].[BIRT Number]=[Reporting Extract Ad Hoc].RITM_ID
GROUP BY [Reporting Extract Ad Hoc].RITM_ID, [Gary Actuals].[BIRT Number]WorkingDays3(APPROVED_ACTUAL,LastOfDELIVERED_ACTUAL) AS Networkingdays
ORDER BY [Reporting Extract Ad Hoc].RITM_ID;
 
Back
Top