Click here to Skip to main content
14,360,161 members
Rate this:
Please Sign up or sign in to vote.
See more:
UPDATE outturn set `year_month` = DATE_ADD(dd,(01-datepart(dd,`year_month`)),`year_month`) WHERE `year_month` LIKE '%-%-02 %'

What I have tried:

UPDATE outturn set `year_month` = DATE_ADD(dd,(01-datepart(dd,`year_month`)),`year_month`) WHERE `year_month` LIKE '%-%-02 %'
Posted
Comments
Richard MacCutchan 8-Nov-19 9:30am
   
What does "not working" mean? Please edit your question and show proper details of what your code is doing and what results you see or do not see.
ZurdoDev 8-Nov-19 11:30am
   
What exactly is the problem?
Richard Deeming 8-Nov-19 13:26pm
   
The fact that you're using LIKE on the column would seem to suggest that you're storing the date as a string instead of using a proper date data type.
MySQL :: MySQL 8.0 Reference Manual :: 11.3.1 The DATE, DATETIME, and TIMESTAMP Types[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100