Mysql query not retruning correct value when date field in where condition -
in sales
table sale_date
field in date
format
when run query,
select * `sales` sale_date=2014-10-01;
return no result. sale_date
field contains value 2014-10-01.
without quotes, interpreted 3 integers subtraction operator (-
) between them: 2014 - 10 - 01 = 2003
. need express value date
, e.g., str_to_date
function:
select * `sales` sale_date = str_to_date('2014-10-01', '%m-%d-%y');
mysql date where
No comments:
Post a Comment