MySQL compare DATE string with string from DATETIME field

前端 未结 7 627
闹比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:55
    SELECT * FROM `calendar` WHERE DATE_FORMAT(startTime, "%Y-%m-%d") = '2010-04-29'"
    

    OR

    SELECT * FROM `calendar` WHERE DATE(startTime) = '2010-04-29'
    
    0 讨论(0)
提交回复
热议问题