I am setting a variable value with CONCAT Function. If the value for the column is NULL then I want empty string to be returned and if not null then the date should be returned as per the specified format.
SET COLUMN_SELECTION_STRING =
CONCAT('IFNULL(TRIM(`MAIN`.''', COLUMN_NAME, '),''),STR_TO_DATE(TRIM(`MAIN`.`', COLUMN_NAME, '`), ''%Y-%m-%d %H:%i:%s'')')
However, I get the following string as a result with character added
IFNULL(TRIM(`MAIN`.'EFFECTIVE_DATE),'),STR_TO_DATE(TRIM(`MAIN`.`EFFECTIVE_DATE`), '%Y-%m-%d %H:%i:%s')
How do I get the string without