Habs geschafft.
SELECT t1.threadid ,t1.threadtitel,t1.threadtype,t1.postcounter,COUNT(t4.postid) AS numPost
FROM mainproject.board_thread AS t1
LEFT JOIN (SELECT DISTINCT ON (t3.tid) t3.tid,t3.thetime
FROM mainproject.users_follow_disc AS t3
WHERE t3.uid=".$_SESSION['userid']."
GROUP BY t3.thetime,t3.tid
ORDER BY t3.tid,t3.thetime) AS thepost
ON thepost.tid=t1.threadid
LEFT JOIN mainproject.board_category AS t2 ON categoryname='".$tag."'
LEFT JOIN mainproject.board_post AS t4 ON t4.threadid=t1.threadid AND t4.creationtime > thepost.thetime
WHERE t1.categoryid=t2.categoryid
GROUP BY t1.threadid,t1.threadtitel,t1.threadtype,t1.postcounter
ORDER BY postcounter
Und einen Fehler in der DB behoben das immer geupdatet wird wenn derjenige im thread war.