2011-04-05 23 views
14

我正在使用以下查詢並利用group_concat函數。但是,有時answers列中的數據正在被切斷;這意味着我沒有得到整個數據,最後它只是被切斷了。mysql group_concat不帶整個數據

我懷疑它可能與數據類型有關......可以將它轉換成更大的數據類型嗎?目前Other1數據類型是text

select SiteName, 
case 
when group_concat(Other1) is not null 
    then group_concat(cast(Other1 AS BLOB)) 
when group_concat(Other1) is null 
    then 'No Response provided' 
end 
'answers' 
from disparities_community_partnerships 
where QuarterId=2 
group by SiteName 

回答

4

一個多個樣品實施例 執行這樣

SET GLOBAL group_concat_max_len = 5555555; 
select SiteName, 
case 
when group_concat(Other1) is not null 
    then group_concat(cast(Other1 AS BLOB)) 
when group_concat(Other1) is null 
    then 'No Response provided' 
end 
'answers' 
from disparities_community_partnerships 
where QuarterId=2 
group by SiteName 
0

設置group_concat_max_len查詢之前:

SET GLOBAL group_concat_max_len = 9999999;