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
 General SQL Server Forums
 New to SQL Server Programming
 SQL SERVER QUARY

Author  Topic 

biswanath23
Starting Member

4 Posts

Posted - 2009-07-31 : 01:35:25


Select ForumTypeDetails.ForumTypeID,max(forumdetails.date) as Date,ForumTypeDetails.ForumName,ForumTypeDetails.ForumDetails,
count(forumdetails.ForumTypeID)as Posting,forumdetails.userID
From ForumTypeDetails
Left Join forumdetails
On forumdetails.ForumTypeID =ForumTypeDetails.ForumTypeID and forumdetails.ParentID=0
Group by ForumTypeDetails.ForumTypeID,
ForumTypeDetails.ForumTypeID,ForumTypeDetails.ForumName,ForumTypeDetails.ForumDetails,forumdetails.userID


Table:forumdetails >> MessageID,ParentID,userID,Subject,Message,Date,IsBlocked,ForumTypeID

Table:ForumTypeDetails >>ForumTypeID,ForumName,ForumDetails,IsBlocked

i also want to count the reply under the Posting in a single query(other fields are also needed),can any one help me !!
Thanks .

Sachin.Nand

2937 Posts

Posted - 2009-07-31 : 03:13:07
Is it giving some error or the resultset is wrong?
Please post some sample data?

PBUH
Go to Top of Page

biswanath23
Starting Member

4 Posts

Posted - 2009-07-31 : 03:18:42
quote:
Originally posted by Idera

Is it giving some error or the resultset is wrong?
Please post some sample data?

PBUH




No it dont gives any error . I need to count the message , threads with other query !
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2009-07-31 : 03:24:22
What do u mean by this requirement "reply under the Posting in a single query "?I could not see any column name as "Posting".

PBUH
Go to Top of Page

biswanath23
Starting Member

4 Posts

Posted - 2009-07-31 : 03:31:44
quote:
Originally posted by Idera

What do u mean by this requirement "reply under the Posting in a single query "?I could not see any column name as "Posting".

PBUH



the main thing is I need to Count the Total THREAD after that NEED to count the message under each THREAD . LIKE this forum .


Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2009-07-31 : 03:49:22
Select ForumTypeDetails.ForumTypeID,max(forumdetails.date) as Date,ForumTypeDetails.ForumName,ForumTypeDetails.ForumDetails,
count(forumdetails.ForumTypeID)as Posting,forumdetails.userID
From ForumTypeDetails
Left Join forumdetails
On forumdetails.ForumTypeID =ForumTypeDetails.ForumTypeID and forumdetails.ParentID=0
Group by ForumTypeDetails.ForumTypeID,
ForumTypeDetails.ForumTypeID,ForumTypeDetails.ForumName,ForumTypeDetails.ForumDetails,forumdetails.userID
WITH ROLLUP

PBUH
Go to Top of Page
   

- Advertisement -