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