tags:

views:

22

answers:

1

How do I get all the values after the first delimiter? In the following example I am expecting '[email protected],[email protected]'

(02:40) mysql>select substring_index('[email protected],[email protected],[email protected]', ',',  1) as first;
+-----------------+
| first           |
+-----------------+
| [email protected] |
+-----------------+
1 row in set (0.00 sec)

(02:41) mysql>select substring_index('[email protected],[email protected],[email protected]', ',',  -1) as last;
+-----------------+
| last            |
+-----------------+
| [email protected] |
+-----------------+
1 row in set (0.00 sec)
+2  A: 
   select substring('[email protected],[email protected],[email protected]',
   instr('[email protected],[email protected],[email protected]', ',') + 1) as first;
Michael Pakhantsov