Yeah the same topic each time.
So I think I’ve got it working with this. There was over 1000 results from this so I tried adding
AND t.id = post.topic_id
This shortened the list to 16 results but there were still 4 results of the same thing. Not sure how to fix that.
SELECT
t.id as topic_id,
pa.post_id,
pa.user_id,
pa.created_at,
u.created_at
FROM post_actions pa INNER JOIN users u ON u.id = pa.user_id INNER JOIN topics t on t.id = t.id INNER JOIN posts p on p.topic_id = p.topic_id
WHERE post_id = 15000
AND t.id = 7000
AND post_action_type_id = 2
AND u.created_at < t.created_at - INTERVAL '2 DAY'
EDIT: Changed
INNER JOIN posts p on p.topic_id = p.topic_id
to
INNER JOIN posts p on p.topic_id = t.id
which cut it down to 16 results like before.
Now I think the reason theres still 16 is because t.id = t.id. Not sure what I can change it to though