SELECT a.*, b.*, count(tcat) AS topics, count(tcat) AS posts FROM forum a INNER JOIN forum_tp b ON b.tfid = a.fid GROUP BY tfid ORDER BY a.ford, b.tdate ASC
Jak pobrać ilość topiców gdzie tcat = 0??
Znalazłem już odpowiedź.
SELECT a.*, b.*, count(DISTINCT IF(tcat=0, tid, NULL)) AS topics, count(DISTINCT IF(tcat>0, tid, NULL)) AS posts FROM forum a INNER JOIN forum_tp b ON b.tfid = a.fid GROUP BY tfid ORDER BY a.ford, b.tdate ASC
Mam tylko nadzieję że to wszystko będzie działać
