1

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.

Nick
  • 138,499
  • 22
  • 57
  • 95
GMD
  • 761
  • 5
  • 21
  • 1
    Can you show us the entire procedure? at least up to and including this line? – Nick Mar 14 '19 at 13:16
  • Possible duplicate of [MySQL pivot table query with dynamic columns](https://stackoverflow.com/questions/12598120/mysql-pivot-table-query-with-dynamic-columns) – Raymond Nijland Mar 14 '19 at 13:17
  • The possible duplicate is there because i noticed the `@PivotQuery` variable so iam assuming you are trying the make a dynamic pivot query. – Raymond Nijland Mar 14 '19 at 13:19

0 Answers0