MySQL compare DATE string with string from DATETIME field

前端 未结 7 668
闹比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:42

    SELECT * FROM sample_table WHERE last_visit = DATE_FORMAT('2014-11-24 10:48:09','%Y-%m-%d %H:%i:%s')
    

    this for datetime format in mysql using DATE_FORMAT(date,format).

提交回复
热议问题