Subject Help with Firebird date ranges.
Author

I am a complete noobie in regards Firebird, :-( and I have 1 system with that has Firebird installed.


I need to be able to report on the last 7 days data from the date a report is run. 


Currently i have managed to cobble together (from a script, i have found) a script that will run and give me the current 'weeks' data. Sadly this only starts from the Monday of the week. However, as stated, I need the data to be the previous 7 days.


Is anyone able to advise where i am going wrong, and possibly offer up a solution?


Many thanks in advance.


The script i have is:


OUTPUT 'Macrologs.csv' DELIMITER ',';

 

SELECT csv_data

  FROM (

    SELECT

  MACRO_KEY || ',' ||

               TIMEREF || ',' ||

               MACRO || ',' ||

               DESCRIPTION || ',' ||

               OPERATOR || ',' ||

               REASON || ',' ||

               SITENUM || ',' ||

               REPLICATED || ',' ||

               WORKSTATION csv_data,

        CASE

            WHEN EXTRACT (WEEK FROM TIMEREF) = EXTRACT (WEEK FROM CURRENT_DATE) THEN ‘Today’           

            ELSE 'Other'

       END period

       FROM MACROLOG

               ORDER BY TIMEREF)

WHERE period = 'Today';