How do I query between two dates using MySQL?

前端 未结 10 2271
滥情空心
滥情空心 2020-11-22 00:58

The following query:

SELECT * FROM `objects` 
WHERE (date_field BETWEEN \'2010-09-29 10:15:55\' AND \'2010-01-30 14:15:55\')

returns nothin

10条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-22 01:46

    DATE() is a MySQL function that extracts only the date part of a date or date/time expression

    SELECT * FROM table_name WHERE DATE(date_field) BETWEEN '2016-12-01' AND '2016-12-10';
    

提交回复
热议问题