开发者

Simple sqlite3 syntax question

开发者 https://www.devze.com 2023-03-19 15:02 出处:网络
Im new to sqlite3 (and databases in general for that matter). Anyway, in my database i have a date column and i wanted to get all of the data within the 3 days of the current date.开发者_如何学PythonH

Im new to sqlite3 (and databases in general for that matter). Anyway, in my database i have a date column and i wanted to get all of the data within the 3 days of the current date.开发者_如何学Python Here is the query I have. I am just not sure if there is a built in way to get nearby dates in sqlite3. I dont know what to put in the '?'s.

SELECT date FROM fooTable WHERE date('now') ???????


Try this (3 days is 3*86400 seconds):

SELECT date FROM fooTable WHERE strftime('%s', now) - strftime('%s',date) < 259200
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号