Unfortunately, I have a field column which contains values like
- 4
- 12,3
- 8,5,6,7
I’m going to write a SELECT statement, whose result would be:
- 4
- 12
- 8
How can I do it in practice, since MySQL does not provide a “split” function?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use MySQL’s
SUBSTRING_INDEXfunction:However, keeping lists in delimiter-separated strings is generally an inefficient use of a relational database management system like MySQL: it is often better to normalise your data structure by keeping such lists in a separate table of
(id, value)pairs.