Skip to content

Instantly share code, notes, and snippets.

@tfgrahame
Created May 14, 2018 10:07
Show Gist options
  • Save tfgrahame/94dd6a9c4b47f51aa0d259985f1c42fe to your computer and use it in GitHub Desktop.
Save tfgrahame/94dd6a9c4b47f51aa0d259985f1c42fe to your computer and use it in GitHub Desktop.
group_concat-genres
SELECT DISTINCT
pg.pid,
GROUP_CONCAT(g.topleveltext,
' | ',
g.secondleveltext,
g.thirdleveltext
SEPARATOR ' | ') AS 'genres'
FROM
pip_genre pg
JOIN
genre g ON g.genre_id = pg.genre_id
GROUP BY pg.pid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment