i want to write this query for php


SET @sql = NULL; SELECT   GROUP_CONCAT(DISTINCT     CONCAT(       'max(CASE WHEN ca.date = ''',       date_format(date, '%Y-%m-%d'),       ''' THEN coalesce(ca.remarks, ''N'') END) AS `',       date_format(date, '%Y-%m-%d'), '`'     )   ) INTO @sql FROM time_dimension where date>='2020-09-01'   and date <= '2020-09-30'; select @sql; SET @sql    = CONCAT('SELECT ca.employee_id,                ', @sql, '              from             (               select c.date, a.employee_id,a.remarks               from time_dimension c               left join attendance a on c.date=a.date             ) ca             where ca.date>=''2020-09-01''               and ca.date <= ''2020-09-30''                and employee_id is not null             group by ca.employee_id'); select @sql; PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;