选择计数postgres间隔时间

时间:2013-01-13 09:11:54

标签: postgresql

我用它来计算最后75分钟发送的数据,但我总是0,同时在最后75分钟发送数据

select count(*) as result 
from data.data 
where last_send_date > (clock_timestamp() - interval '75 minutes')'';

我的错误是哪些提示(db engine postgres)?

1 个答案:

答案 0 :(得分:1)

这个怎么样?

SELECT count(*) as results
FROM data
WHERE last_date BETWEEN (now() '- 45 minute'::interval)::timestamp
AND now();