Two tables. Post
and Tag
. Many to Many bi-directional relationship.
Post Table Tag Table Post_Tag Pivot Table
--------------- ------------ -----------------
id content id name id_post id_tag
--------------- ------------ -----------------
1 hey there 1 php 1 1
2 python 1 2
I want to get all posts with their tags.
I've tried this:
SELECT P.title, T.tag
From Post P
JOIN Tag T
ORDER BY P.id DESC
It works, but it gives duplicates:
hey there, php
hey there, python
Is there a way to group tags together in one row here. Thanks