我在数据库中有记录:
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小时的行。
就我而言,仅应删除A
。 Checked
作为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
您有什么主意吗?
答案 0 :(得分:0)
我终于找到了解决方法:
datetime(Checked/10000000 - 62135596800, 'unixepoch') <= datetime('now', '-1 day')