我有一个具有以下属性的表
id(int) | shift_id(int) | emp_id(int) | start_date(varchar)
列 startdate 实际上以格式存储日期 - "dd/MM/yyyy"
(来自 asp.net)
现在我必须执行一个查询,在该查询中我必须过滤所有 startdate 大于今天的结果
所以我写了以下查询
SELECT *, STR_TO_DATE(start_date,'%d/%m/%Y'), DATE(NOW())
FROM emp_shift_relation
WHERE
STR_TO_DATE(start_date,'%m/%d/%Y') > DATE(NOW())
但我得到了错误的结果。我得到的一些值如下
"id" "shift_id" "emp_id" "start_date" "STR_TO_DATE(start_date,'%d/%m/%Y')" "DATE(NOW())"
"335" "2" "115" "06/04/2013" "2013-04-06" "2013-05-11"
"340" "1" "118" "06/04/2013" "2013-04-06" "2013-05-11"
"349" "2" "121" "06/04/2013" "2013-04-06" "2013-05-11"
"353" "2" "123" "06/04/2013" "2013-04-06" "2013-05-11"
"357" "1" "125" "06/04/2013" "2013-04-06" "2013-05-11"
"361" "2" "129" "06/04/2013" "2013-04-06" "2013-05-11"
"367" "2" "131" "06/04/2013" "2013-04-06" "2013-05-11"
"371" "1" "132" "06/04/2013" "2013-04-06" "2013-05-11"
如您所见, start_date 实际上比现在少。请帮我更正查询。提前谢谢。