JJHardis
JJHardis

Reputation: 1

select count postgres interval time

I am using this to count data in that send in last 75 mints but i got always 0 , in the same time there is data sent in last 75 mints

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

Any tips where my mistake is (db engine postgres)?

Upvotes: 0

Views: 223

Answers (1)

bonCodigo
bonCodigo

Reputation: 14361

How about this?

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

Upvotes: 1

Related Questions