How can I get records from database using only day name. I have a column in the database which is from_day
and to_day
.
If I pass Tue
then I need result where from
is less Tue
(like Mon
), and end
is greater (like Wed
).
For example, if I pass Tue
then I need records where the column should have Mon
as from_day
and to_day
should be Wed
or Tue
.
I have tried this:
SELECT booking_times.* FROM booking_times WHERE 'Tue' BETWEEN
DATE_FORMAT(booking_times.from_day, 'D') AND
DATE_FORMAT(booking_times.to_day, 'D');