webForumDet fria alternativet

COUNT i forum

1 svar · 188 visningar · startad av kristoffer

kristofferMedlem sedan juni 20001 266 inlägg
#1

Med

SELECT fth.intId, COUNT(*) AS intNewPosts
FROM tblForumpost_fps AS fps, tblForumthread_fth AS fth
WHERE fps.intId_usr <> 1 AND fps.datDateposted >
        (SELECT MAX(datLogoutdate)
      FROM tblLogin_log
      WHERE intId_usr = 1) AND fth.intId = fps.intId_fth
GROUP BY fth.intId

får jag ut antal nya inlägg i varje tråd. Hur skriver jag för att samtidigt få ut totalt antal inlägg i varje tråd? Måste jag använda två recordset?

LarsGMedlem sedan dec. 200012 465 inlägg
#2
SELECT fth.intId, COUNT(*) AS intNewPosts,
 (select count(*) from tblForumpost_fps 
  where intId_fth = fth.intid) as intTotalPosts
FROM tblForumpost_fps AS fps, tblForumthread_fth AS fth
WHERE fps.intId_usr <> 1 AND fps.datDateposted >
        (SELECT MAX(datLogoutdate)
      FROM tblLogin_log
      WHERE intId_usr = 1) AND fth.intId = fps.intId_fth
GROUP BY fth.intId
247 ms totalt · 3 externa anrop · cache AV · v20260731051352-full.56cc9887
123 ms — hämta statistik (db)
116 ms — hämta tråd, inlägg och bilagor (db)
122 ms — hämta forumlista (db)