ET @sql = NULL; SELECT GROUP_CONCAT(DISTINCT CONCAT(' sum (case when DATE_FORMAT(message_accepted_by_signalmash, '%d')= ''',da, ''' then msg_count else 0 end ) AS `',da,'`') )INTO @sql FROM(SELECT DATE_FORMAT(message_accepted_by_signalmash, '%d')AS da FROM mdr m )d; SELECT @sql; SET @sql = CONCAT('SELECT u.username, ' , @sql, ' from mdr m ', 'join user u', 'on u.iduser = m.iduser', 'group by u.username');
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
what's wrong in this query?
error:-Incorrect parameters in the call to native function 'CONCAT'