Unfortunately, I have a field column which contains values like
I\'m going to write a SELECT statement, whose r
You can use MySQL function SUBSTRING_INDEX(str,delim,count)
SELECT SUBSTRING_INDEX(value,',',1) As value FROM ...
Use MySQL's SUBSTRING_INDEX function:
SELECT SUBSTRING_INDEX(field, ',', 1)
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.