Click here to Skip to main content
15,914,403 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900