Tuesday, 6 August 2013

Count all records from midnight until now()

Count all records from midnight until now()

I'm trying to grab all records created from midnight of the current day
until the time a button is pressed.
I've tried something like this meanwhile but it doesn't really solve the
issue.
SELECT COUNT(*) FROM ... AND a.lastAction > now() - interval '24 hour'"
What I need is something like:
SELECT COUNT(*) FROM ... AND a.lastAction > midnight() AND a.lastAction <
now()
Is there a way to convert a string like "2013-08-06 00:00:01" to a timestamp?

No comments:

Post a Comment