B
BobRoyAce
I inherited a database and need to make some changes to some queries. The
table and field names are crazy (include spaces, etc.), but I have nothing
to do with that. So, the issue is that when I modified a query to get what's
shown below, and I attempt to execute it, I get the following error message:
Reserved error (-3011); there is no message for this error.
All I did was add the ORDER BY clause. Without that the query runs but I get
records back in wrong order. What is wrong with this query?
------- QUERY BEGINS -------
SELECT TableA.[Month Name], (100*(TableB.[SumOfTotal
Production]/TableB.[SumOfTotal Capacity])) AS Efficiency
FROM TableA INNER JOIN (MonthData
INNER JOIN TableB ON MonthData.[System Month Number] = TableB.[System Month
Number])
ON TableA.[Month Order] = MonthData.[Fiscal Month Number]
GROUP BY TableA.[Month Name], (100*([SumOfTotal Production]/[SumOfTotal
Capacity])), TableB.[Fiscal Year]
HAVING TableB.[Fiscal Year]=2004
ORDER BY MonthData.[Fiscal Month Number]
------- QUERY ENDS -------
table and field names are crazy (include spaces, etc.), but I have nothing
to do with that. So, the issue is that when I modified a query to get what's
shown below, and I attempt to execute it, I get the following error message:
Reserved error (-3011); there is no message for this error.
All I did was add the ORDER BY clause. Without that the query runs but I get
records back in wrong order. What is wrong with this query?
------- QUERY BEGINS -------
SELECT TableA.[Month Name], (100*(TableB.[SumOfTotal
Production]/TableB.[SumOfTotal Capacity])) AS Efficiency
FROM TableA INNER JOIN (MonthData
INNER JOIN TableB ON MonthData.[System Month Number] = TableB.[System Month
Number])
ON TableA.[Month Order] = MonthData.[Fiscal Month Number]
GROUP BY TableA.[Month Name], (100*([SumOfTotal Production]/[SumOfTotal
Capacity])), TableB.[Fiscal Year]
HAVING TableB.[Fiscal Year]=2004
ORDER BY MonthData.[Fiscal Month Number]
------- QUERY ENDS -------