MySQL compare DATE string with string from DATETIME field

前端 未结 7 672
闹比i
闹比i 2020-11-29 19:55

I have a question: Is it possible to select from a MySQL database by comparing one DATE string \"2010-04-29\" against strings that are stored as DATETIME (2010-04-29 10:00)?

7条回答
  •  囚心锁ツ
    2020-11-29 20:37

    SELECT * FROM `calendar` WHERE DATE(startTime) = '2010-04-29';
    

    it helps , you can convert the values as DATE before comparing.

提交回复
热议问题