This address: http://www.cnblogs.com/qiaoyihang/p/6270165.html
MySQL itself does not have the split function, but the custom function that we implement the exhaustion function is very simple
syntax for creating a function
User-defined functions are a way to extend the MySQL function, which is no different from the function that comes with MySQL itself.
To create a custom function syntax:
CREATE [AGGREGATE] FUNCTION function_name RETURNS {STRING| INTEGER | REAL | DECIMAL}
Split function
CREATE FUNCTIONsplit_str (xVARCHAR(255), DelimVARCHAR( A), POSINT)RETURNS VARCHAR(255)RETURN REPLACE(SUBSTRING(Substring_index (x, Delim, POS), LENGTH (Substring_index (x, Delim, POS-1))+ 1), Delim,"');
Usage:
SELECT Split_str (string, delimiter, position)
Example:
SELECT Split_str ('a|bb|ccc|dd'| ' 3 as third; + -- -----+ | | + -- -----+ | CCC | + -- -----+
MySQL Split function