Sqlite SELECT * in the last 7 days

I am trying to do SELECT * to retrieve rows in the last 7 days in SQLite.

table structure is as follows

CREATE TABLE 'session' ('rowID' INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL , 'steps' INTEGER, 'stop_time' DATETIME NOT NULL  DEFAULT CURRENT_TIMESTAMP)

How should I do it? Im new on this

+5
source share
1 answer
SELECT * FROM session WHERE stop_time > (SELECT DATETIME('now', '-7 day'))

Refer to the documentation

+12
source

All Articles