I am working on building a series of queries and reports based on a database so my associates can simply click on the reports and get important figures. I've run into a problem when it comes to aggregates based on a query with a subquery in it.
I'm used to using PHP and MYSQL to run queries and manage databases, so I'm new to Access syntax and limitations. I'm building these reports in Access 2010.
An example of the issue I'm running into can be seen with this query:
This query works well to generate reports, but gives me "Multi-Level GROUP By Clause is not allowed in subquery" errors when I try to sum Elapsed Mileage or Average MPG and Cost. I tried to create aggregates at the query level but this resulted in syntax errors.
I've done some googling and it looks like I need to do something with multiple tables or queries, but I don't know enough about access to figure it out with unrelated examples. Any help would be appreciated!
I'm used to using PHP and MYSQL to run queries and manage databases, so I'm new to Access syntax and limitations. I'm building these reports in Access 2010.
An example of the issue I'm running into can be seen with this query:
Code:
SELECT Mile1.Date, Mile1.[Card Number], Mile1.Vehicle, Mile1.Mileage, Mile1.Gallons, (Select Max(Mileage) From Transactions Where Mileage < Mile1.[Mileage] And Vehicle = Mile1.Vehicle) AS PrevMileage, [Mileage]-[PrevMileage] AS Elapsed, ([Mileage]-[PrevMileage])/[Gallons] AS MPG, 1/([MPG]/3.59) AS [Cost in Dollars Per Mile] FROM Transactions AS Mile1 WHERE (((Mile1.[Card Number])=[Which Card Number?]));
I've done some googling and it looks like I need to do something with multiple tables or queries, but I don't know enough about access to figure it out with unrelated examples. Any help would be appreciated!
Comment