In Microsoft Access I have a table called Cons:
Person | Date_Consumption | Consumption
For a number of people every first day of the month over a couple of years I am writing down the consumption.
I want to create a report for each person with a chart displaying the consumption over the last 12 months.
I can create the chart without the 12 month restriction with this query:
SELECT (Format([Date_Consumption],"mmm")) AS Date_Cons, Consumption FROM Cons;
How can I only display the last 12 months.
I tried to work with SELECT TOP 12 of the DESC sorted table, but this fails because I don’t know how to limit the selection to the person that is currently active on the report.
In sql Limiting of results is done by where clause.
you can get the last 12 months data by restricting the the last date after which you want the results.