我有一个Sqlite数据库,我想在其中选择TIMESTAMP列中的值在某个特定日期之前的行.我认为这很简单,但我无法完成.我试过这个:
SELECT * FROM logged_event WHERE logged_event.CREATED_AT < '2010-05-28 16:20:55'
Run Code Online (Sandbox Code Playgroud)
和日期函数一样,它有各种变化.我已经阅读了http://sqlite.org/lang_datefunc.html和http://www.sqlite.org/datatypes.html,我希望该列是一个数字类型,并且比较将在unix时间戳值.显然不是.有谁可以提供帮助?如果重要的话,我在Sqlite Expert Personal中尝试这个.
编辑:
这是类型表描述:
CREATE TABLE [logged_event]
(
[id] INTEGER NOT NULL PRIMARY KEY,
[created_at] TIMESTAMP,
[name] VARCHAR(64),
[data] VARCHAR(512)
);
Run Code Online (Sandbox Code Playgroud)
并且测试数据:
INSERT INTO table VALUES(1,'2010-05-28T15:36:56+0200','test','test');
INSERT INTO table VALUES(2,'2010-05-28T16:20:49+0200','test','test');
INSERT INTO table VALUES(3,'2010-05-28T16:20:51+0200','test','test');
INSERT INTO table VALUES(4,'2010-05-28T16:20:52+0200','test','test');
INSERT INTO table VALUES(5,'2010-05-28T16:20:53+0200','test','test');
INSERT INTO table VALUES(6,'2010-05-28T16:20:55+0200','test','test');
INSERT INTO table VALUES(7,'2010-05-28T16:20:57+0200','test','test');
Run Code Online (Sandbox Code Playgroud)