Compare dates in MySQL

后端 未结 5 1861
野性不改
野性不改 2020-11-27 03:31

I want to compare a date from a database that is between 2 given dates. The column from the database is DATETIME, and I want to compare it only to the date format, not the d

5条回答
  •  悲&欢浪女
    2020-11-27 04:28

    I got the answer.

    Here is the code:

    SELECT * FROM table
    WHERE STR_TO_DATE(column, '%d/%m/%Y')
      BETWEEN STR_TO_DATE('29/01/15', '%d/%m/%Y')
        AND STR_TO_DATE('07/10/15', '%d/%m/%Y')
    

提交回复
热议问题