Creating a MySQL SET's from a string
问题 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 回答1: 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