这是我的查询:
mysql> select * from jobs where datediff(now(),str_to_date(last_modified,'%M %d,%Y'))>=1095;
我得到0结果
mysql>从作业中选择max(last_modified);
+--------------------+ | max(last_modified) | +--------------------+ | 9/9/2013 | +--------------------+ 1 row in set (0.06 sec) mysql>
它似乎并没有很好地工作,我不知道为什么. I think it has to do with the original formatting of the last_modified column
UPDATE
mysql> select distinct(last_modified) from jobs where datediff(now(),str_to_date(last_modified,'%m/%d/%Y'))>=1095 limit 10; +---------------+ | last_modified | +---------------+ | 12/4/2003 | | 12/5/2003 | | 12/6/2003 | | 12/8/2003 | | 12/9/2003 | | 12/10/2003 | | 12/11/2003 | | 12/12/2003 | | 12/13/2003 | | 12/14/2003 | +---------------+ 10 rows in set (0.00 sec) mysql>
Inpego.. 5
用str_to_date(last_modified,'%m/%d/%Y')
而不是str_to_date(last_modified,'%M %d,%Y')
用str_to_date(last_modified,'%m/%d/%Y')
而不是str_to_date(last_modified,'%M %d,%Y')