Compare DATE string with string from DATETIME field in Mysql

If you want to select all rows where the DATE part of a DATETIME column matches a certain table. Best and easy possible way is use Mysql Date() fuction.
The DATE() function extracts the date part of a date or date/time expression.

Example:

SELECT * FROM `tablename` WHERE DATE(datetimecol) = '2010-04-29';

Study More about most important built-in Date Functions in MySql.

Leave a Reply

Your email address will not be published. Required fields are marked *

1 × 4 =