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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-03-22 : 09:13:51
|
| Phil writes "Hi,I would like to get the results of the following two statements as one, should I use an outer join? what would the syntax be?1.select * from TABLE1 A inner join TABLE2 as B on substring(A.campus_code,2,2)+ A.id7 =substring(B.campus_code,2,2)+ B.id72.select *from TABLE1 A inner join TABLE3 as B on substring(A.campus_code,2,2)+ A.id7 = B.staff_idTABLE1 is the common link between the TABLE2 and TABLE3. I would like to get the results of TABLE1 and TABLE2 + the results of TABLE1 and TABLE3 all together.I appreciate the help.Thanks,Phil" |
|
|
davidpardoe
Constraint Violating Yak Guru
324 Posts |
Posted - 2002-03-22 : 09:45:48
|
| UNION will join 2 result sets together============================Chairman of The NULL Appreciation Society"Keep NULLs as NULL" |
 |
|
|
jcelko
Esteemed SQL Purist
547 Posts |
Posted - 2002-03-22 : 11:41:18
|
| SELECT * FROM TableA AS A, TableB AS B WHERE SUBSTRING(A.campus_code, 2, 2) + A.id7 IN (SUBSTRING(B.campus_code, 2, 2)+ B.id7, B.staff_id);--CELKO--Joe Celko, SQL Guru |
 |
|
|
|
|
|
|
|