SQLite删除早于

时间:2018-10-09 07:07:29

标签: sqlite sqlite-net sqlite-net-extensions

我在数据库中有记录:

record B with property `Checked` set to be current date in UTC.
record A with property `Checked` set to be current date in UTC - 48 hours.

然后,我想创建查询以删除属性为Checked且早于24小时的行。

就我而言,仅应删除AChecked作为bigint存储在数据库中。

db.Execute("DELETE FROM User WHERE Checked <= strftime('%s', datetime('now', '-1 day'))"); // A and B are not deleted
db.Execute("DELETE FROM User WHERE Checked <= datetime('now', '-1 day')"); // A and B are deleted
db.Execute("DELETE FROM User WHERE Date(checked) <= datetime('now', '-1 day')"); // A and B are not deleted
db.Execute("DELETE FROM User WHERE datetime(checked) <= datetime('now', '-1 day')"); // A and B are not deleted

您有什么主意吗?

1 个答案:

答案 0 :(得分:0)

我终于找到了解决方法:

datetime(Checked/10000000 - 62135596800, 'unixepoch') <= datetime('now', '-1 day')