SQL : Update only year in the date field

UPDATE mytable
SET datefield = CONCAT('2012','-',MONTH(datefield),'-',DAYOFMONTH(datefield))
WHERE YEAR(datefield) = 2006;

No comments:

Post a Comment

Python contextlib for Timing Python code

If you've ever found yourself needing to measure the execution time of specific portions of your Python code, the `contextlib` module o...