CONCAT_WS(separator,string1[,string2,...])

Description: Concatenates all strings together in the order specified, with separator given by separator, and returns the resulting string.

Numeric arguments are converted to strings. Any NULL string is skipped. A NULL separator causes a NULL to be returned.

Examples:

  • CONCAT_WS('+','a','2','z') returns a+2+z.

  • CONCAT_WS('/',14,5,2000) returns 14/5/2000.

  • CONCAT_WS(NULL,'a','b') returns NULL.

Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.