---
title: "COUNT i forum"
type: "forum-thread"
url: "https://www.webforum.nu/amne/databaser-sql/46375-count-i-forum"
topic: "Databaser & SQL"
topic_url: "https://www.webforum.nu/amne/databaser-sql"
author: "kristoffer"
published: "2002-06-20T23:14:22.000Z"
updated: "2002-06-22T20:51:51.000Z"
replies: 1
views: 195
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/databaser-sql/46375-count-i-forum"
---

# COUNT i forum

## #1 — kristoffer, 2002-06-20T23:14Z

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?

Permalänk: https://www.webforum.nu/p/46375

## #2 — LarsG, 2002-06-22T20:51Z

```
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
```

Permalänk: https://www.webforum.nu/p/704062

---

Tråden på webben: https://www.webforum.nu/amne/databaser-sql/46375-count-i-forum
