SET @sql := NULL; SET @a = CONCAT ('SELECT GROUP_CONCAT(DISTINCT CONCAT( SUM( CASE WHEN CONVERT ( tNumber, UNSIGNED INTEGER ) > 200 AND DATE_FORMAT(tStartDate, ''%Y%m'') = ''', DATE_FORMAT(period, ''%Y%m''), ''' THEN 1 ELSE 0 END) AS `', DATE_FORMAT(period, '%b %Y'), '` ), '' ...'}]},
Error caused by the absence of `period` variable within the dynamic SQL scope. It must be encapsulated correctly for execution.
Collection
[
|
...
]