Hello traceya...@yahoo.com.au, Thursday, May 2, 2019, 11:15:24 PM, you wrote:
> 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? Well, sorry, but it's quite unclear what you expect as output, so I will guess that you want a set consisting of strings made up from the various text fields in your log. The alternative is that you just want a list of workstations (which is what your current query returns, if it works at all.) > The script i have is: > OUTPUT'Macrologs.csv' DELIMITER ','; This isn't a command in Firebird (or other standard) SQL. You call this a "script". A script for what? You can use OUTPUT in isql to channel the screen output to a file - but you will need the full file path and there is no DELIMITER argument. Whatever...if you are after that complex string with field delimiters for text then this is probably something like what you want: SELECT '"'|| MACRO_KEY ||'",' '"'|| cast (TIMEREF as varchar(10)) ||'",' /* see note below */ '"'|| MACRO ||'",' '"'|| DESCRIPTION ||'",' '"'|| OPERATOR ||'",' '"'|| REASON || ||'",' '"'|| SITENUM ||'",' '"'|| REPLICATED ||'",' '"'|| WORKSTATION ||'"' FROM MACROLOG WHERE TIMEREF >= (CURRENT_DATE - 7) ORDER BY TIMEREF Note, if TIMEREF is a TIMESTAMP, not a DATE, then your varchar for the cast will need to be varchar(25). If this isn't what you are looking for, come back with some more detail about the expected output, environment, etc. Helen --- This email has been checked for viruses by AVG. https://www.avg.com