8

Im trying to do a SELECT * to retrieve rows for last 7 days in SQLite.

the 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 do I do this? Im new at this

Jason
  • 203
  • 4
  • 5

1 Answers1

25
SELECT * FROM session WHERE stop_time > (SELECT DATETIME('now', '-7 day'))

Refer to the documentation

falconcreek
  • 4,170
  • 1
  • 21
  • 22