this is the query I want to execute in MySQL using PHP
SET @sql = NULL; SELECT GROUP_CONCAT(DISTINCT CONCAT( \'max(CASE WHEN ca.dt = \'\'\', date_format(dt, \