views:

508

answers:

2

I somehow need this feature,but MySQL doesn't support it at this moment.

I'm using GROUP_CONCAT(CONCAT(...)) to generate a xml-like stuff.

But when the size exceeds the limit,the xml is just broken!

So I have to somehow make it only retrieve 5 rows !

+1  A: 

Use a temporary table / subquery to limit results? Without seeing your query, it'll be hard to give solid advice for that route.

However, you may find the group_concat_max_len setting to be more useful. It controls the maximum length of a GROUP_CONCAT operation, in string length. Raise it to prevent broken group_concats, when you can't afford to limit results.

Charles
A: 

Not really an answer to your question but a ref for other people who also would want to use a LIMIT clause in GROUP_CONCAT():

A feature-request was filed long ago to MySql developers. Not yet implemented :-(

Serge - appTranslator