I have stored procedure in local mysql version 5.7.18-log which has this block but it is not working on AWS RDS 5.7.23-log.
SELECT GROUP_CONCAT( CONCAT(' GROUP_CONCAT(IF(slf.Name = ''', t.NAME, ''' , slfv.Text, NULL)) AS ', t.NAME )) INTO @PivotQuery
FROM (SELECT slf.NAME FROM searchlogfields slf GROUP BY slf.NAME) t;
It throws
syntax error on "SELECT GROUP_CONCAT( CONCAT(' GROUP_CONCAT(IF(slf.Name = ''', t.NAME, ''' , s"
When tried to run this part of the stored procedure in the new query without Begin&End it works.