I googled and tried several ways to compare date but unfortunately didn't get the result as expected. I have current state of records like following:
mysql> select date_format(date(starttime),'%d-%m-%Y') from data;
+-----------------------------------------+
| date_format(date(starttime),'%d-%m-%Y') |
+-----------------------------------------+
| 28-10-2012 |
| 02-11-2012 |
| 02-11-2012 |
| 02-11-2012 |
| 03-11-2012 |
| 03-11-2012 |
| 07-11-2012 |
| 07-11-2012 |
I would like to compare date and therefore do like this:
mysql> select date_format(date(starttime),'%d-%m-%Y') from data where date_format(date(starttime),'%d-%m-%y') >= '02-11-2012';
+-----------------------------------------+
| date_format(date(starttime),'%d-%m-%Y') |
+-----------------------------------------+
| 28-10-2012 |
| 02-11-2012 |
| 02-11-2012 |
| 02-11-2012 |
| 03-11-2012 |
| 03-11-2012 |
| 07-11-2012 |
| 07-11-2012 |
I believe that the result should not include '28-10-2012'. Any suggestion? Thanks in advance.
date '2012-11-02'
is valid (in fact it's the SQL standard for specifying date literals). See here: sqlfiddle.com/#!2/d41d8/4020 – Honora