I have a MySQL 5 database table field media like set('audio','video','photo')
What i need to do, is in single SELECT statement prefix it's values with some custom string and space after it, if any of the values are present. For example:
audio,video becomes mediaaudio mediavideo
photo becomes mediaphoto
The specifics of the data does not require an external relationship table to be made for corresponding values, so set is sufficient for the current task. I need to prefix them to uniquely identify them later in search results.
Real example:
id media
1 audio,video
2 audio
3 video
4 photo,video
5
Expected result:
id media
1 mediaaudio mediavideo
2 mediaaudio
3 mediavideo
4 mediaphoto mediavideo
5
CONCAT?concat/concatwith a case statement I think... unless you are storing those comma separated values in a single field?