I am trying to represent data for the past MONTH so for example 30 days from April 2nd and continue to update data every month so that on May 2nd, data shows for the 30 days prior to May 2nd.
I will show my current code:
SELECT 'Working Equipment' label, count(*) FROM LOGS_HISTORY
WHERE MODE__ = 'Working'
AND TIME_ >= add_months(sysdate, -1)
union all
SELECT 'Standby Equipment' label, count(distinct TAG_IDENTIFIER) FROM LOGS_HISTORY
WHERE MODE__ = 'Standby'
AND TIME_ >= add_months(sysdate, -1)
It shows data 30 days prior to sysdate, please look through it and advise what should I change?
For your requirement you can use this:
This example query shows how the start date changes from 1st March to 1st April on 2nd May:
Result: