dallas dallas - 3 months ago 48
SQL Question

Converting Mysql text to date

I currently am working with a database that has a month column and a year column.. Both are of type text. Month is stored as 'January' and year is stored as you would expect, '2016'..

Any recommendations for concatenating these and converting them to a date type?


You can use a query like this. you only must change the strings to your fieldnames:


select STR_TO_DATE(concat('2016',' ','April','1'), '%Y %M %D');