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
 SQL Server Development (2000)
 Select query

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-06-14 : 07:22:24
user writes "I have three tables like
tblcategory,tblforum,tbltopic
tblcategory contains all the categories
tblforum contains forums under the categories.
tbltopic contains topics under the forums.
I want to display all topics based on forums and categories.
i need stored procedure for that

my tables are
tblcategory
----------
Cat_ID cat_name
Cat_order

tblforum
--------
Forum_ID
Cat_id
Forum_Order
Forum_name
Forum_description
Date_Started
....
tbltopic
---------
Topic_ID
Forum_ID
Subject
Start_date
Last_entry_date
..."

JasonGoff
Posting Yak Master

158 Posts

Posted - 2004-06-14 : 07:40:29
Not sure exactly what you're looking for, but the SQL below will give

Category Name,Forum Name,subject

for all categories,forums etc.

SELECT cat_name, forum_name, subject
from tblcategory c
inner join tblforum f on c.cat_id=f.cat_id
inner join tbltopic t on t.forum_id=f.forumid
sort by cat_order,forum_order
Go to Top of Page
   

- Advertisement -