我似乎已经达到了为我的交叉表存储过程生成代码的限制 - 是否有LIMT ???
此摘录有效 - 请注意week_id<的限制。 12
SET @sql = NULL;
SELECT
GROUP_CONCAT(DISTINCT
CONCAT(
'sum(case when ref_date_conversion.week_id = ',
ref_date_conversion.week_id,
' then ztablemaster.net_stake else 0 end) `',
week_id, '`'
)
) INTO @sql
from ref_date_conversion
Where week_id <12
;
然而,如果我尝试再运行它几周就会爆炸。 为@sql生成的代码似乎刚用完了。我猜测mysql将自己限制为某个字符串长度???
有解决方法吗?
取值
再解释一下
@sql在我运行时生成它&lt; 12
sum(case when ref_date_conversion.week_id = 1 then ztablemaster.net_stake else 0 end) `1`,
sum(case when ref_date_conversion.week_id = 2 then ztablemaster.net_stake else 0 end) `2`,
sum(case when ref_date_conversion.week_id = 3 then ztablemaster.net_stake else 0 end) `3`,
sum(case when ref_date_conversion.week_id = 4 then ztablemaster.net_stake else 0 end) `4`,
sum(case when ref_date_conversion.week_id = 5 then ztablemaster.net_stake else 0 end) `5`,
sum(case when ref_date_conversion.week_id = 6 then ztablemaster.net_stake else 0 end) `6`,
sum(case when ref_date_conversion.week_id = 7 then ztablemaster.net_stake else 0 end) `7`,
sum(case when ref_date_conversion.week_id = 8 then ztablemaster.net_stake else 0 end) `8`,
sum(case when ref_date_conversion.week_id = 9 then ztablemaster.net_stake else 0 end) `9`,
sum(case when ref_date_conversion.week_id = 10 then ztablemaster.net_stake else 0 end) `10`,
sum(case when ref_date_conversion.week_id = 11 then ztablemaster.net_stake else 0 end) `11`
当我运行它超过12到无限时,我得到@sql切断如下 - 它好像我已经经历了一个字符串限制? - 也许我不确定 - 或者我能做些什么
sum(case when ref_date_conversion.week_id = 1 then ztablemaster.net_stake else 0 end) `1`,
sum(case when ref_date_conversion.week_id = 2 then ztablemaster.net_stake else 0 end) `2`,
sum(case when ref_date_conversion.week_id = 3 then ztablemaster.net_stake else 0 end) `3`,
sum(case when ref_date_conversion.week_id = 4 then ztablemaster.net_stake else 0 end) `4`,
sum(case when ref_date_conversion.week_id = 5 then ztablemaster.net_stake else 0 end) `5`,
sum(case when ref_date_conversion.week_id = 6 then ztablemaster.net_stake else 0 end) `6`,
sum(case when ref_date_conversion.week_id = 7 then ztablemaster.net_stake else 0 end) `7`,
sum(case when ref_date_conversion.week_id = 8 then ztablemaster.net_stake else 0 end) `8`,
sum(case when ref_date_conversion.week_id = 9 then ztablemaster.net_stake else 0 end) `9`,
sum(case when ref_date_conversion.week_id = 10 then ztablemaster.net_stake else 0 end) `10`,
sum(case when ref_date_conversion.week_id = 11 then ztablemaster.net_stake else 0 end) `11`
sum(case when ref_date_conversion.week_id = 12 then