MySQL supports two types of concatenation functions: CONCAT and CONCAT_WS.
CONCAT function contatenates all the argument values like:
SELECTCONCAT(‘Television’,‘Mobile’,‘Furniture’);
This returns the folowing:
TelevisionMobileFurniture
If you want to concatenate with a comma, specify the comma at the end of each value then pass it as an argument:
SELECTÂ CONCAT('Television,','Mobile,','Furniture');
SELECTÂ CONCAT('Television',',','Mobile',',','Furniture');
This will return the following:
Television,Mobile,Furniture
You can omit the extra work by using CONCAT_WS function. CONCAT_WS means concatenate with separator. This is similar to CONCAT function but accepts the separator as the first argument.
Read the rest of the tutorial here:Â http://blog.sqlauthority.com/2014/06/07/mysql-introduction-to-concat-and-concat_ws-functions/