mysql> mysql> SELECT SUBSTRING_INDEX('www.java2s.com', '.', -2); +--------------------------------------------+ | SUBSTRING_INDEX('www.java2s.com', '.', -2) | +--------------------------------------------+ | java2s.com | +--------------------------------------------+ 1 row in set (0.00 sec) mysql>