Bug #30098 limit support for group_concat
Submitted: 27 Jul 2007 13:29 Modified: 27 Jul 2007 14:03
Reporter: Olaf van der Spek (Basic Quality Contributor) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S4 (Feature request)
Version:* OS:Any
Assigned to: CPU Architecture:Any
Tags: qc
Triage: Needs Triage: D5 (Feature request)

[27 Jul 2007 13:29] Olaf van der Spek
Description:
Hi,

group_concat does support order by, but not limit. I'd like to only include the first 24 rows in the concat, but that's not possible currently.

Current syntax:
GROUP_CONCAT([DISTINCT] expr [,expr ...]
             [ORDER BY {unsigned_integer | col_name | expr}
                 [ASC | DESC] [,col_name ...]]
             [SEPARATOR str_val])

How to repeat:
select distinct pid from xcl_prev_players where pid != ? and lid = ? order by points desc limit 24

select group_concat(distinct pid order by points desc limit 24) from xcl_prev_players where pid != ? and lid = ?
[27 Jul 2007 13:38] Miguel Solorzano
Thank you for the bug report feature request.
[27 Jul 2007 14:03] Olaf van der Spek
And if you do truncate the result, please don't include part of a value.
[25 Oct 2007 0:02] Dan Kloke
Agreed, this would be a very useful (and used) feature.

Similar to 12544, submitted back in 2005-08-12.
[25 Oct 2007 1:16] Dan Kloke
There are cases where this can be done with clever use of delimiters and SUBSTRING_INDEX, and maybe some REPLACE thrown in.

But sometimes not.
[19 Oct 2009 14:27] Valeriy Kravchuk
Bug #12544 was marked as a duplicate of this one.
[12 May 2015 13:45] Yehuda Deutsch
Any chance this issue will get some attention?
This can be solved either by allowing to set 'group_concat_max_len' with any value starting from 1, or adding LIMIT to GROUP_CONCAT.

Thanks
[15 May 2015 15:06] Gerrit Hoekstra
8 years on and still no progress on such a simple, yet language-enriching enhancement?
[19 Mar 2017 18:10] Rick James
Just another vote for this feature.  And another example of the need: http://stackoverflow.com/questions/42789101/mysql-fast-check-if-hash-exists