PHP MySQL GROUP_CONCAT Limit -


i couldn't find wether possible so, there option limit group_concat in mysql-function?

e.g.:

group_concat(colname order colname desc limit 5) 

i don't want use subquery since slow down performance. can slice array later in php, wondering or mysql had option achieve in mysql already.

no, can this:

substring_index(group_concat(colname order colname desc), ',', 5) 

you may want pay attention group concat maximum length (see group_concat_max_len), if intermediate string might larger 1024 characters. can change default.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -