Mysql date function not working for less than

前端 未结 3 669
难免孤独
难免孤独 2020-12-31 00:54

I need to get all records those equal and less than 2012-12-28 i used bellow query for this, booking_time is DATETIME field, and there are records less than 2012-12-28 but i

3条回答
  •  爱一瞬间的悲伤
    2020-12-31 01:33

    wrap the value with single quote and surely it will work

    SELECT * 
    FROM ctx_bookings 
    WHERE DATE(booking_time) <= '2012-12-28' 
    ORDER BY id ASC
    
    • SQLFiddle Demo

提交回复
热议问题