Skip to content

Instantly share code, notes, and snippets.

@suin
Created May 19, 2017 08:05
Show Gist options
  • Save suin/3ba10287990b703c57bcaad21a936345 to your computer and use it in GitHub Desktop.
Save suin/3ba10287990b703c57bcaad21a936345 to your computer and use it in GitHub Desktop.
SELECT articles.title, GROUP_CONCAT(keywords.name) AS keywords FROM articles
LEFT JOIN article_keywords
ON articles.id = article_keywords.article_id
LEFT JOIN keywords
ON keywords.id = article_keywords.keyword_id
GROUP BY articles.id
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment