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.
| Author |
Topic |
|
dreamaboutnothing
Starting Member
47 Posts |
Posted - 2004-10-23 : 13:27:03
|
| Hi Guys,I have 3 tables like thisFirst 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 tableANDPub_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 populateDescription of five levels should look likeMid Atlantic/Delaware/a/b/cand if there are few levels empty then it should look likeMid Atlantic/DelawarePlease help me.I am really stuck because i can see upto 2 levels not five levels.I needyour 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.MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
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 |
 |
|
|
|
|
|
|
|