GROUP_CONCAT function in Mysql - Mysql Views : 195
Tagged in : Mysql
0 0
Send mail

GROUP_CONCAT function in Mysql



GROUP_CONCAT() function is used to concatenate column values into a single string. Note that this function will not count null values. This is very useful group by function if you need records from database with multiple rows in single string with specified seperator(e.g. Comma seperated).

Example:

Table tbl_users have 4 records in column "name".
- Hariharan
- Harish
- Haripranav
- Prabhu

SELECT name FROM tbl_users;
OutPut:
- Hariharan
- Harish
- Haripranav
- Prabhu

SELECT GROUP_CONCAT(name) FROM tbl_users;
Output:
Hariharan,Harish,Haripranav,Prabhu
By Rekha, On - 2010-10-01



    Login to add Comments .