Created
October 11, 2016 03:50
-
-
Save AndrewRayCode/b3a807654f3835e25ea7213c29adee8e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 "posts".*, | |
Group_concat(tags.id, "↕") AS keyword_ids, | |
Group_concat(tags.NAME, "↕") AS keyword_names, | |
Group_concat(Ifnull(tags.description, "null"), "↕") AS keyword_descriptions, | |
FROM "posts" | |
LEFT JOIN "post_tags" | |
ON "post_tags"."post_id" = "posts"."id" | |
LEFT JOIN "tags" | |
ON "post_tags"."keyword_id" = "tags"."id" | |
WHERE "tags"."name" IN ( 'sometag' ) | |
GROUP BY "posts"."id" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment