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 |
|
Stuart010
Starting Member
2 Posts |
Posted - 2011-11-15 : 06:57:12
|
Hi all,I have a bit of an issue relating to combining multiple tables.OverviewI have a total of 5 tables1.Applicants2.Appbankdetails3.AppltdAddr4.PersonalDetails5.UmbrellaCompanyTables 2,3,4 are left outer joined to table 1 through a common field; My stumbling block is that I need to combine table 5, however a common field only exists between 4 and 5.I have searched extensively for an answer but I have maybe not phrased my question correctly and would be most grateful if someone could assist. My code so far:-SELECT *FROM ITRIS.dbo.Applicants ApplicantsLEFT OUTER JOIN ITRIS.dbo.AppBankDetails AppBankDetails ON Applicants.APP_ID = AppBankDetails.APP_ID LEFT OUTER JOIN ITRIS.dbo.AppLtdAddr AppLtdAddr ONApplicants.APP_ID = AppLtdAddr.APP_IDLEFT OUTER JOIN ITRIS.dbo.PersonalDetails PersonalDetails ONApplicants.APP_ID = PersonalDetails.APP_IDLEFT OUTER JOIN ITRIS.dbo.PersonalDetails PersonalDetails ON UmbrellaCompany.ID = PersonalDetails.UMBRELLA_COMPANY_ID From the above the issue I have relates to the final outer join, should I be using a different syntax?RegardsStuart |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-11-15 : 06:59:00
|
| LEFT OUTER JOIN ITRIS.dbo.UmbrellaCompany UmbrellaCompanyON UmbrellaCompany.ID = PersonalDetails.UMBRELLA_COMPANY_ID==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
Stuart010
Starting Member
2 Posts |
Posted - 2011-11-15 : 07:11:07
|
| Spot on nigelrivett, worked an absolute treat.Thank you for your help! |
 |
|
|
|
|
|