Search code examples
mysqldateoperators

How to use greater than operator with date?


No idea what is going on here. Here is the query, right from phpMyAdmin:

SELECT * FROM `la_schedule` WHERE 'start_date' >'2012-11-18';

But I consistently get all records in the table returned, including those with start date 2012-11-01. What gives?


Solution

  • you have enlosed start_date with single quote causing it to become string, use backtick instead

    SELECT * FROM `la_schedule` WHERE `start_date` > '2012-11-18';