Bug #12544 LIMIT support for GROUP_CONCAT
Submitted: 12 Aug 2005 9:16 Modified: 19 Oct 2009 14:26
Reporter: Martin Jansen Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:5.x OS:Linux (Linux)
Assigned to: CPU Architecture:Any
Triage: D5 (Feature request)

[12 Aug 2005 9:16] Martin Jansen
Description:
In some situations it would be handy to be able to specify a LIMIT clause for GROUP_CONCAT:  The following query on the "world" example database spits out a lot of cities for Australia, but there are certainly cases where one is only interested in the first n cities:

SELECT Country.Name, GROUP_CONCAT(City.Name) FROM City, Country WHERE Country.Continent = 'Oceania' AND Country.Code = City.CountryCode GROUP BY Country.Code;

Support for GROUP_CONCAT(... LIMIT n,m) would solve this problem very niftily.

How to repeat:
Run

SELECT Country.Name, GROUP_CONCAT(City.Name) FROM City, Country WHERE Country.Continent = 'Oceania' AND Country.Code = City.CountryCode GROUP BY Country.Code;

on the "world" example database.
[19 Oct 2009 14:26] Valeriy Kravchuk
Duplicate of Bug #30098.