https://www.techonthenet.com/mysql/functions/substring_index.php MySQL: SUBSTRING_INDEX Function This MySQL tutorial explains how to use the MySQL SUBSTRING_INDEX function with syntax and examples. Description The MySQL SUBSTRING_INDEX function returns the substring of string before number of occurrences of delimiter . Syntax The syntax for the SUBSTRING_INDEX function in MySQL is: SUBSTRING_INDEX( string, delimiter, number ) Parameters or Arguments string The source string. delimiter The delimiter to search for in string . number The number of times to search for delimiter . Note If number is a positive value, everything from the left of the targeted delimiter is returned by the SUBSTRING_INDEX function. If number is a negative value, everything from the right of the targeted delimiter is returned by the SUBSTRING_INDEX function. See also SUBSTRING function . Applies ...