xcode 过去 7 天的 Sqlite SELECT *

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3634542/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 19:41:55  来源:igfitidea点击:

Sqlite SELECT * for Last 7 days

iphonexcodesqlite

提问by Jason

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

我正在尝试执行 SELECT * 以在 SQLite 中检索过去 7 天的行。

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

我该怎么做呢?我是新手

回答by falconcreek

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

Refer to the documentation

参考文档