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 |
|
slimt_slimt
Aged Yak Warrior
746 Posts |
Posted - 2007-08-24 : 04:16:29
|
| Hi,i havet1 id_t1 phone1_t1 phone2_t1t2 phoneWhen i do join t1 with other tables, i do the following:select * from t1join t2 on t1.phone1_t1 = t2.phone or t1.phone2_t1 = t2.phone somehow this method is doing nothing.Is there anything faster/better to join two tables on field which has to be looked in two different fields?thank you |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-08-24 : 23:20:59
|
| Tried this?select * from t1 join t2 on t1.phone1_t1 = t2.phoneunion allselect * from t1 join t2 on t1.phone1_t2 = t2.phone |
 |
|
|
Zoroaster
Aged Yak Warrior
702 Posts |
Posted - 2007-08-24 : 23:42:17
|
| Or this should work:SELECT * FROM T1 WHERE phone1_t1 in(SELECT phone from t2)OR phone2_t1 in (SELECT phone from t2) |
 |
|
|
|
|
|