MySQL select datetime field where date equals today
You have to strip the time part of booked_at
because 2015-08-05 09:10:56
is not equal to 2015-08-05
. Try this:
select date(booked_at) from booking_dates where date(booked_at) = CURDATE();
To use index on column booked_at
:
SELECT date(booked_at)
FROM booking_dates
WHERE booked_at >= CURDATE()
AND booked_at < CURDATE() + INTERVAL 1 DAY