How do I query between two dates using MySQL?

前端 未结 10 2264
滥情空心
滥情空心 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:52

    Just Cast date_field as date

    SELECT * FROM `objects` 
    WHERE (cast(date_field as date) BETWEEN '2010-09-29' AND 
    '2010-01-30' )
    

提交回复
热议问题