I have a problem with group_concat in mysql query :
It stops on 513 number !
This is the normal query and it returns 813 rows :
SELECT *
FROM survey_votes
WHERE sid = '4'
and now the problem is with this query:
SELECT s.*,
GROUP_CONCAT(v.oid) AS myoids
FROM survey s
LEFT JOIN survey_votes v ON s.sid=v.sid
WHERE s.sid='4'
This returns 1 row containing an array ‘myoids’ up to 513 strings.
strucutr of table ‘survey’:
sid int(11)
stitle varchar(255)
sdesc text
soptions text
sdate datetime
active int(1)
survey_votes:
vid int(11)
sid int(11)
uid int(11)
uip varchar(255)
oid int(11)
sdate datetime
myoids only contains upto 513 rows :
Array
(
[0] => 1
[1] => 1
[2] => 3
.........
[511] => 1
[512] =>
)
This is because MySQL truncates the result of
GROUP_CONCATafter a certain limit:Try increasing the value of
group_concat_max_lenvariable using theSETcommand: