I have a table 'setlists' in mysql with columns 'year' 'month' 'day' of int type that I would like to str_to_date and concat into a new column 'date' in the same table. This is what I have so far but I cant seem to get the syntax right. It wont run. I have already created the new date column and set it as date type.
UPDATE setlists
SET date = str_to_date(concat(year,'-',month,'-',day), '%Y-%m-%d') FROM setlists
Data:
I am trying to concat the year month day columns into the date column of the same table.
date year month day
null 2018 01 01
null 2017 01 01
The current error output is as follows:
Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM setlists' at line 2