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 |
Rohan.cmu
Starting Member
1 Post |
Posted - 2014-05-06 : 00:52:24
|
Table 1PropertyId123456Table 2PropertyID PropertyCode PropList ID1 2 453 4 675 6 89Table 3PropertyID IType1 3 2 3 3 11 4 11 5 36 3Target TablePropertyID PropertyCode1 452 453 674 675 896 89Step1: Join Table 1 and Table 3Steo 2: If Table 1.PropertyId.Itype = 3 Then Join Table 1 and Table 3 on Table1.PropertyID = Table2.PropertyIdElseStep 3: If Table 1.PropertyId.Itype = 11 Then Join Table 1 and Table 2 on Table1.PropertyID = Table2.PropListId |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-05-06 : 07:23:36
|
What have you tried so far?Note that your "Step 2" doesn't make sense, since table 3 does not have a PropertyCode column. |
 |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-05-06 : 08:52:13
|
quote: Originally posted by gbritton What have you tried so far?Note that your "Step 2" doesn't make sense, since table 3 does not have a PropertyCode column.Also, Table 1 has PropertyCode as the second column, but your expected results shows values from the PropListID column instead.
|
 |
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2014-05-06 : 09:25:06
|
But my homework needs done now! How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-05-06 : 09:30:31
|
quote: Originally posted by DonAtWork But my homework needs done now! How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Yeah! I have problems answering folks homework questions:1. Usually ridiculously simple and contrived2. If I post an answer, what does the student learn? |
 |
|
|
|
|