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)
 A Complicated Join Query

Author  Topic 

balauae
Starting Member

3 Posts

Posted - 2004-11-05 : 05:22:36
Dear All,

I am doing a auction project and my requirement is

I need to show the Main category along with total count of products in it and its subcategories...

Electrical & Households (11)
Kitchen(5) Dining(6)

In the above out put the Electrical & Household is the main category and Kitchen(5) Dining(6) are subcategories..

My table is

tbl_cat

cid Numeric Identity

Parent Numeric

Cat_Name Varchar(100)



tbl_Procucts

pid Numeric Identity

Cat_Id Numeric (foreign key of tbl_cat)

Prod_Name Varchar(100)



For clear idea pls visit [url]http://www.erealdeal.com[/url]

Pls assist me ...

Hint: I tried in many SQL SERVER forums ...no one answered...If this forum response...i will stick in this...I feel this is best among SQL Forums..

Thanks

Bala






AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2004-11-05 : 05:26:21
have a search here for hierarchies.
Go to Top of Page

balauae
Starting Member

3 Posts

Posted - 2004-11-05 : 05:38:08
But that are not exactly what i need...can u please inform me if u find a reply for my need

Thanks in advance
Regds
Bala
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-11-05 : 09:09:30
if you need help ,then you need to help us first. post some CREATE TABLE statements to show us your tables (only relevant tables and columns to your problem) and then some INSERT statements to generate sample data. Then, based on that sample data, what results you are looking for.

- Jeff
Go to Top of Page

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2004-11-05 : 09:18:55
Click on the picture below, and tell me if the menu of photo categories on the left is similar to what you are trying to accomplish...

If so then your answer is what Andrew suggested. I have a link that shows how to build and gather information with a tree hierarchies:

http://www.seventhnight.com/treestructs.asp

Corey
Go to Top of Page

balauae
Starting Member

3 Posts

Posted - 2004-11-05 : 23:19:27
Thx buddy

I will update my post with table structure soon...Thanks seventhnight its useful article..

Regds
Bala
Go to Top of Page
   

- Advertisement -