Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Counting Records

Author  Topic 

alexmac
Starting Member

8 Posts

Posted - 2001-06-27 : 04:50:14
Hi I am writing a message board application using ASP and Access 2000. On one page I wish to display the number of replies to a post.

I need the count statement to count the number of replies on each message (or row) that I am displaying.

At the moment the statement I use looks like this:

SELECT
COUNT(messageID) AS PostCount, messageID, messagePicture, messageSubject, messageFromID, messageName, messageTime, messageViews

FROM messageTbl

WHERE ForumID='" & forumID & "' AND MessageLink='0'

GROUP BY messageID, messagePicture, messageSubject, messageFromID, messageName, messageTime, messageViews

ORDER BY messageID DESC

Forum ID is the ID of the forum the user has selected to view and messageLink is what message (if any) the post is linked to. If a message has a linkID of 0 it is the first post of a new thread.

The trouble is that this statement returns 1 instead of the number of posts linked to it.

Any ideas?

Thanks

Alex


   

- Advertisement -