SUBSTRING_INDEX
Returns the substring from string before count occurrences of the delimiter.
SUBSTRING_INDEX(string, delimiter, count)
delimiterThe delimiter to search for.
countThe number of occurrences of the delimiter.
Examples
SELECT SUBSTRING_INDEX('www.mysql.com', '.', 2)