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)
 Conditional query!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-02-18 : 22:07:01
Sam writes "Hi all,
Here is my question.

I have a table say AdvtAdvt_ID is a identity field which has four columns related to the question..
Advt_ID Section_ID  AdType_ID  P_Title
1 1 1 1
2 2 1 1
3 3 2 1
4 4 3 1
5 1 2 2
6 1 3 Null


Section_ID is Identity field in section table.

AdType_ID is identity field in AdType

P_Title is identity field in respective section related table. Like if section_ID = 1,then P_Title will be the id field from Manufacturer table which has corresponding M_Desc field.
for section_ID =2 it should read D_desc field from distributor table.The Id field will be D_ID which is equal to P_title.

Now the query should read all the advertisement Id in the Advt
table at first instance.

If Section_ID is 1 ,then it should read M_Desc,if it is 2 then it should read D_Desc.
For Advt_ID of 5 ,it should read M_desc from Manufacturer table where its id field is 2 as 1 ia already retrived for Advt_ID = 1 from this table.

This is part of my query.I have to even join this result with my other queries and get the complete stuff.

I would appreciate if the experts here can look into this and give a breakthrough.

Advance Thanks for your response.
have a nice week-end.

Sam."
   

- Advertisement -