Created
August 27, 2013 20:25
-
-
Save igaln/6358682 to your computer and use it in GitHub Desktop.
Take a column value of comma delimited strings, compare it to another table ids to retrieve values belonging to each delimeted value, group them back into a comma delimited string, and store them in a column using GROUP_CONCAT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT v2m6q_npg_plants.name, GROUP_CONCAT(v2m6q_npg_plants_seasons.name) as seasons FROM v2m6q_npg_plants, v2m6q_npg_plants_seasons WHERE find_in_set(v2m6q_npg_plants_seasons.id, v2m6q_npg_plants.seasons)>0 | |
GROUP BY name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment