Reputation: 17461
I have a table in Postgres database "logs" which holds the error logs with their creation date
sample query : Select creation_date from logs
returns
"2011-09-20 11:27:34.836"
"2011-09-20 11:27:49.799"
"2011-09-20 11:28:04.799"
"2011-09-20 11:28:19.802"
I can find out the latest error using the command
SELECT max(creation_date) from log;
which will return "2012-02-06 12:19:28.448"
Now what I am looking for a query which could return the errors occured in last 15 minutes.
Any help on this will be appreciated
Upvotes: 0
Views: 405
Reputation: 13646
This should do the trick:
SELECT * FROM logs WHERE creation_date >= NOW() - INTERVAL '15 minutes'
Upvotes: 2