Reputation: 2900
I have a simple mysql table called messages with the following fields:
I simply want to make a query that returns all records where CREATE_DATE is between 11pm yesterday and 11pm today.
When saying yesterday and today I mean by getting the current date from mysql, not hardcoding it in.
Upvotes: 0
Views: 338
Reputation: 56397
select * from table where create_date
between concat_ws(' ',curdate(),'23:00:00') - interval 1 day
and
concat_ws(' ',curdate(),'23:00:00')
Upvotes: 3