Say there is such table:
mysql> SELECT * FROM tags; +---------+--------+ | post_id | tag_id | +---------+--------+ | 1 | 2 | | 1 | 3
SELECT post_id FROM ( SELECT post_id, count(tag_id) AS counter FROM tags WHERE tag_id IN (1,3) GROUP BY post_id ) WHERE counter = 2
Use GROUP_CONCAT() for the second part of your question
SELECT post_id, GROUP_CONCAT(tag_id ORDER BY tag_id ASC SEPARATOR ',') FROM tags