SQLite strftime查询问题

时间:2017-01-20 10:12:56

标签: sql sqlite

我想尝试在c中执行此查询,但我总是得到这样的功能:strftime"

str = "SELECT strftime('%Y-%m-%d %H:%M:%S',TIMESTAMP) AS 'Data',"
                "SUM (PEOPLENUMBER) AS 'PEOPLENUMBER'"
                "FROM COUNTINGEVENT WHERE TIMESTAMP >= '2017-01-19'"
                "AND TIMESTAMP < '2017-01-21'"
                "GROUP BY strftime('%d%H%M',TIMESTAMP)"
                "ORDER BY Data;";

这是表countingevent里面的Timestamp的定义

"TIMESTAMP  DATETIME DEFAULT CURRENT_TIMESTAMP"

我怎么解决?

1 个答案:

答案 0 :(得分:0)

使用'now'而不是'TIMESTAMP'