Can you show the result of doing *JUST* the UNION part of that?
And you only show 3 records in the "returns like this". I assume it is actually returning many more?
And you apparently misunderstand how SELECT DISTINCT works.
It applies to *ALL* the fields in your SELECT. If *ANY* fields in the two records are different, then the records are different and the DISTINCT will show them.
Putting parentheses around the field name, as you did with
SELECT DISTINCT(p.postId), p.roomId, ...
is meaningless. It changes nothing. Remove them and you will get identical results.