My table have data structure like this
cate_id task_id date_start date_end other
34 14 2012-06-27 10:21:39 2012-06-27 10:21:42 Volume
34 14 2012-06-27 10:21:42 2016-01-01 00:00:00 Volume
UPDATE tbl SET other ='new'
WHERE task_id =14
AND cate_id=34
AND DATE_FORMAT('date_start','%Y-%m-%d')='2012-06-27'
AND DATE_FORMAT('date_end','%Y-%m-%d')='2016-01-01';
My goal is only compare the date with format '%Y-%m-%d' not whole the value.
Can do like the above mysql Script? Because it succeed executed sql script ,but does not update the col that I have specific? Anyone could tell me please? thanks
Hum...
Try removing the quotes around date_start and date_end:
AND DATE_FORMAT(date_start,'%Y-%m-%d')='2012-06-27'
AND DATE_FORMAT(date_end,'%Y-%m-%d')='2016-01-01';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With