Skip to content
Advertisement

Reduce outcomes base on sub query

I’m trying to run that query but I would like to reduce the result only if the previous Mois (months in english) has a minimum of 3 months.

For example, I have the table OtifDataToExport in MS Access with these fields:

I think I’m closed to, but I can’t figure out the solution in MS Access.

Any help is very appreciated.

Advertisement

Answer

Unless I’ve misunderstood your requirements, I might suggest either of the following approaches, depending upon whether or not you wish to display those records with fewer than 3 previous months:

To calculate an average using only the last 3 months’ worth of data, you could change the join criteria to only include those records within 3 months of the current record, e.g.:

Or, to use exactly three previous months, you could use something like this:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement