user1775888 user1775888 - 2 months ago 6
SQL Question

How to select rows be create after 1 hour?

How to select rows be create after 1 hour?
now I'm select all rows and use momentjs to compare now, how to use single postgresql query do it?

id | create_date

1 | 2016-09-22 00:36:41

2 | 2016-09-21 00:36:41

3 | 2016-09-22 01:36:41

if now is

2016-09-22 01:37:41
select
1, 2


SELECT *
FROM signup_pending
??// WHERE create_date - '1 hour'::INTERVAL

Answer

Maybe you want something like that:

 SELECT * 
 FROM signup_pending 
 WHERE now() < create_date + '1 hour'::INTERVAL  
Comments