1

SELECT @query1 := GROUP_CONCAT(CONCAT('SELECT * FROM asterisk.', table_name) SEPARATOR ' UNION ALL ') AS CUSTOMQUERY FROM Information_Schema.tables WHERE table_name LIKE '%custom%'; PREPARE stmt FROM @query1; EXECUTE stmt; DEALLOCATE PREPARE stmt;

..but at the end of the result we got missing query like SELECT * FROM asterisk.custom_70003 UNION ALL SELECT * FROM asterisk.custom_70006 UNION ALL SELECT * FROM asterisk.custom_70007 UNION ALL SELECT * FROM asterisk.custom_70010 UNION ALL SELECT * FROM asterisk.custom_70011 UNION ALL SELECT * FROM asterisk.custom_70042 UNION ALL SELECT * FROM asterisk.custom_70043 UNION ALL SELECT * FRO ..

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FRO' at line 1

so it gives me error

..I want to use this in my SSRS report .and ssrs querybuilder prompt me for parameter .. so if we use this in procedure it will be benefit for me.because in that way i can easily access this in my report.

4

1 回答 1

0

您应该增加group_concat_max_len值。

来自文档:group_concat_max_len是 GROUP_CONCAT() 函数的最大允许结果长度(以字节为单位)。默认值为 1024。

于 2012-08-30T09:52:58.337 回答