douhuan1901 2017-10-01 11:50
浏览 16

在mysql之间的日期没有正确工作

when I fetch data from table "like date from 01/09/2017 to 30/09/2017" then it's okey..

BUT When I am trying to fetch data from date 01/09/2017 to 01/10/2017 then its only showing the data of DATE 01/10/2017(not previous month data i.e 01/09/2017)

I am using MySQL Database.

SELECT * FROM `tablename` where date between '01/09/2017' AND '01/10/2017'
  • 写回答

3条回答 默认 最新

  • droos02800 2017-10-01 11:55
    关注

    If you are saving the value as DATE format it should work. If not (you are saving the data as VARCHAR you can convert it to date and get the correct results.

    STR_TO_DATE('01/09/2017', '%m/%d/%Y')
    
    评论

报告相同问题?