I am trying to select all data from an SQlite database for the last 24 hours. There is a column 'Date' where the date is present and that is in EPOCH time. I've tried a variety of different commands but this seems to be what I have so far:
SELECT *
FROM Log
WHERE UNIX_TIMESTAMP(DATE_ADD(NOW(),INTERVAL -1 DAY))
and
SELECT * FROM Log WHERE Date >= datetime('now', ' '-24 hours');
This doesn't seem to work. Ultimately, I am trying to convert the last 24 hours of this database to a CSV in Unix and have only the last 24 hours there using the following:
sqlite3 -header -csv /opt/demo/log_20170501131627.db " select * from Log
WHERE Date >= datetime('now', ' '-24 hours');" > /opt/demo/DB.csv
Any ideas?