Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想要实现的是从 SQLite 数据库中检索当前日期前 3 天和当前日期后 3 天范围内的记录,包括当前日期。
怎么做?
假设您的日期以 SQLite 日期函数预期的格式存储,即 ,yyyy-mm-dd您可以使用该date函数对日期进行计算:
yyyy-mm-dd
date
SELECT * FROM MyTable WHERE DateCol BETWEEN date('now', '-3 days') AND date('now', '3 days')