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)
 Need to see five levels not two levels.Please help

Author  Topic 

dreamaboutnothing
Starting Member

47 Posts

Posted - 2004-10-23 : 13:27:03
Hi Guys,
I have 3 tables like this
First Table:
1.Pub_id (nvarchar(10),NOT NULL)
2.Section_id (nvarchar(30),NOT NULL)
3.Dir_Category_id (int,NOT NULL)

Second Table:
1.Pub_id (nvarchar(10),NOT NULL)
2.Pub-Section_id (nvarchar(10),NOT NULL)
3.Dir_category_id (int,NOT NULL)
4.category_lvl1_id(nvarchar(7),NULL)
5.category_lvl2_id(nvarchar(7),NULL)
6.category_lvl3_id(nvarchar(7),NULL)
7.category_lvl4_id(nvarchar(7),NULL)
8.category_lvl5_id(nvarchar(7),NULL)


Third Table:
Pub_id (nvarchar(10),NOT NULL)
Category_lvl_id (nvarchar(7),NOT NULL)
Category_description (nvarchar(120),NULL)

Ouput should look like this:
Pub_id|Section_id|category_id|Count|Desc|

Conditions: Three mentioned fields from first table should match
with the first three fields of second table
AND
Pub_id +category_lvl_id(all Five)of table two should match with
first two fields of third table.Once they are matched then description should populate


Description of five levels should look like
Mid Atlantic/Delaware/a/b/c
and if there are few levels empty then
it should look like
Mid Atlantic/Delaware

Please help me.I am really stuck because i can see upto 2 levels not five levels.I need
your help in seeing 5 levels. Thanks

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-10-23 : 16:15:06
Give us CREATE TABLE statements, INSERT statements, and the code you have so far. We should be able to knock it out pretty quick then.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

dreamaboutnothing
Starting Member

47 Posts

Posted - 2004-10-23 : 16:32:04
Hi,
The coding and other stuff you can see from this question with subject
"Different levels in one record not in many records" which i had posted earlier. Thanks
Go to Top of Page
   

- Advertisement -