- 论坛徽章:
- 7
|
各位好
最近我想做个日常统计,统计昨天的数据量,就是从昨天的0:00 - 24:00间的数据量,所以我写了以下sql --
select count(*) from v_dpnsummary where starttime>(current_date, INTERVAL'-1 days')
结果报错 -- HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
这里starttime是timestamp类型, 我想,大概因为(current_date, INTERVAL'-1 days')的生成数据类型不是timestamp了吧?请问真的是这样吗?或者还有什么别的日期函数可以给一个现有datetime加上interval后仍是timestamp呢?
我试过了--
select count(*) from v_dpnsummary where starttime> (timestamp current_date, INTERVAL '-1 days'));
和
select count(*) from v_dpnsummary where starttime> (timestamp (current_date, INTERVAL '-1 days'));
都不对,请指教. |
|