Dino Geek, try to help you

How to use GROUP_CONCAT function in MariaDB?


The GROUP\_CONCAT function in MariaDB is used to concatenate strings from a group into a single string with various options.

Here is one simple example:

```
SELECT student_grade, GROUP_CONCAT(student_name ORDER BY student_name DESC SEPARATOR ‘;’)
FROM Students
GROUP BY student_grade;
```
In this example, GROUP\_CONCAT function returns a string of student names for each student grade, which is sorted in descending order and separated by ‘;’.

Here are some of the frequently used parameters for the GROUP\_CONCAT function:
- `ORDER BY`: It will sort the results as per the given column(s).
- `SEPARATOR`: It is used to separate each concatenated value.
- `DISTINCT`: It is used to remove duplicates from the results.

Remember that the result is truncated to the maximum length that is given by the group_concat_max_len system variable, which has a default value of 1024. To overcome this, you can set the maximum length of the GROUP_CONCAT function by setting the system variables like:

```
SET SESSION group_concat_max_len = 10000;
```
This will set the maximum allowed result length to 10000 characters for the duration of the session.


Simply generate articles to optimize your SEO
Simply generate articles to optimize your SEO





DinoGeek offers simple articles on complex technologies

Would you like to be quoted in this article? It's very simple, contact us at dino@eiki.fr

CSS | NodeJS | DNS | DMARC | MAPI | NNTP | htaccess | PHP | HTTPS | Drupal | WEB3 | LLM | Wordpress | TLD | Domain name | IMAP | TCP | NFT | MariaDB | FTP | Zigbee | NMAP | SNMP | SEO | E-Mail | LXC | HTTP | MangoDB | SFTP | RAG | SSH | HTML | ChatGPT API | OSPF | JavaScript | Docker | OpenVZ | ChatGPT | VPS | ZIMBRA | SPF | UDP | Joomla | IPV6 | BGP | Django | Reactjs | DKIM | VMWare | RSYNC | Python | TFTP | Webdav | FAAS | Apache | IPV4 | LDAP | POP3 | SMTP

| Whispers of love (API) | Déclaration d'Amour |






Legal Notice / General Conditions of Use