i have table messages with column date (format DATETIME) how i can search messages where date = xxxx-05-09 ?
select * from messages where date = 'xxxx-05-09';
i have table messages with column date (format DATETIME) how i can search messages where date = xxxx-05-09 ?
select * from messages where date = 'xxxx-05-09';
Try this:
select * from messages where Extract(Month from date) = 5 and Extract(Day from date) = 9;
You can also use DATE_FORMAT function:
select * from messages where DATE_FORMAT(date, "%Y-%m-%d") = 'xxxx-05-09';
https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format
DATE function can help
SELECT * FROM messages WHERE MONTH(date) = '05' AND DAY(date) = '09';