Group_Concat SQL Function

The group_concat() function takes one (1) or two (2) arguments and concatenate all the non Null values and returns them by default it creates a comma seperated string, if second argument is provided it will be used as seperator.

Syntax group_concat(Column , [ Seperator ])

/* Following will produce EmployeeID and Project1 , Project2 etc */ 
SELECT EmployeeName, group_concat(Projects) FROM Employees Group by EmployeeName;

/* Following will produce EmployeeID and Project1 - Project2 etc */ 
SELECT EmployeeName, group_concat(Projects, '-') FROM Employees Group by EmployeeName;