Greetings Stackian Overflowers,
I'm trying to overwrite data in an existing column and do a STR_TO_DATE in the case it is already set.
Here's the code :
SELECT IF(columnA = '../../..' , '0000/00/00' , STR_TO_DATE(columnA, '%m/%d/%Y)
FROM tablename
WHERE extract_date = '2018-12-31';
In all reality, I must use this logic to make an update on the table. I tried this :
UPDATE tablename
IF columnA = '../../..' THEN
SET columnA = '0000-00-00' ELSE
SET columnA = STR_TO_DATE(columnA,'%m/%d/%Y);
Could use any help on the matter.
Aucun commentaire:
Enregistrer un commentaire