You will need to add some criteria to group them:
CREATE TABLE sample (integer foo, char(1) bar); INSERT INTO sample VALUES (1, 'a'), (2, 'a'), (3, 'a'), (4, 'b'), (5, 'b'), (6, 'b'), (7, 'c') ...; SELECT GROUP_CONCAT(foo ORDER BY foo, ',') FROM sample GROUP BY bar
Edit:
Try the following:
select group_concat(foo) from ( select s1.foo, (count(*) - 1) / 3 grp from sample s1 join sample s2 on s1.rowid >= s2.rowid group by s1.rowid ) final group by grp
source share