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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Get count from table

Author  Topic 

enak
Starting Member

34 Posts

Posted - 2006-11-18 : 10:26:40
I have been asked to write a simplified version of a forum. I need to display the number of posts that each topic has. Here is what I have so far:

SELECT ForumID, Name + '-' + Description AS Name,
count(*) AS TotalThreads,
MostRecentPostAuthor, MostRecentPostDate
from tblForums
Group By ForumID, Name, Description,MostRecentPostAuthor, MostRecentPostDate

However, this does not work. Can anyone help me?

Thanks,
enak

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-18 : 11:11:59
[code]SELECT ForumID, Name + '-' + Description AS Name,
count(*) AS TotalThreads,
from tblForums
Group By ForumID, Name, Description
[/code]

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page
   

- Advertisement -