Q:

MySQL - get all posts (distinct) with tags

I have this category_post_tag pivot table. 
For example:
category_id         post_id         tag_ig
    1                   1              1
    1                   1              2
    1                   2              3
    1                   3              1
    1                   3              3
    2                   4              5

Now lets say i want to grab some posts, belonging to my first category id.
Then i would select all the posts from the this pivot table that has the category_id 1
and i would probably group them by post_id. 
Result:
post_id: 1, 2, 3

I don't know if this is the best way to do it, but i think its not so bad. 
Ok, but my problem is when i want to know each tag belonging to that returned post. 
So if i group_by post_id i will always have only one tag to one post. 
Is there a way to get back all the tags belonging to one post, and still have a distinct post array? 

A:

Use GROUP_CONCAT()
select post_id, 
       group_concat(tag_id) as tag_ids
from category_post_tag 
where category_id = 1
group by post_id

