Is there a way to create a set from a string of separated values in MySQL? For example:
'the,quick,brown,fox'
=>
'the','quick','brown','fox'
A sort of inverse EXPORT_SET without the bit fiddeling.
Regards
解决方案
If you're trying to use the set in an IN statement, instead of splitting the string, you could do a comparison like:
SELECT * FROM `table` WHERE 'the,quick,brown,fox' REGEXP CONCAT('(^|,)','word','(,|$)');
I'm not sure how efficient this would be if your dataset is large, but it might be faster than reading into and selecting from a temporary table.