I want to count records based on a cut-off time. My cut-off time is midnight.
So, when a user inserts a new record, I want to know how many records have been inserted between NOW() and my cut-off time (which would be 12:00AM today). I don’t know to tell MySQL to dynamically go 12:00AM of today… basically, what I want to do is:
SELECT COUNT(id) FROM myTable WHERE createdAt is between now and today's 12:00AM
A query like this should do the trick.
or simply
if you don’t expect to have any records with createdAt date in the future. You can also use the “Between” operator as so.