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 it returns zero rows. does anyone has idea ?
SELECT * FROM ctx_bookings WHERE DATE(booking_time)<=2012-12-28 ORDER BY id ASC
Table filed
+---------------------+ | booking_time | +---------------------+ | 2012-12-20 03:10:09 | | 2012-12-25 02:10:04 | +---------------------+
Please anybody know why is this happening ?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With