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 |
Syima
Starting Member
13 Posts |
Posted - 2007-09-07 : 00:52:53
|
Hi there, anyone can help me to join Table_1 & Table_2 to get below output: Thanks.Table_1 id, mbb_benefitcategory, mbb_projecttype5001369, lkp_val_growth, lkp_val_applTable_2id, lookup_type, lookup_code, name500, mbb_prj_benefitcategory, lkp_val_growth, growth501, mbb_prj_projecttype, lkp_val_appl, applicationOutput:Table_1.id, Table_2.Name as A, Table_2.Name as B5001369, growth, application |
|
Kristen
Test
22859 Posts |
Posted - 2007-09-07 : 02:34:28
|
You may want to search for OTLT (One True Lookup Table)SELECT T1.id, BC.name, PT.nameFROM Table_1 AS T1 JOIN Table_2 AS BC ON BC.lookup_type = 'mbb_prj_benefitcategory' AND BC.lookup_code = T1.mbb_benefitcategory JOIN Table_2 AS PT ON PT.lookup_type = 'mbb_prj_projecttype' AND PT.lookup_code = T1.mbb_projecttype Kristen |
 |
|
Syima
Starting Member
13 Posts |
Posted - 2007-09-07 : 03:57:55
|
Hi KristenTQ very much for ur help. It works. :) |
 |
|
|
|
|
|
|