Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Hey guys Hope your well I have a temp table called #EmaxAddress which have the following Columns FDMSAccountNoExternal_IDParentsfidDBA NameLegal NameStreetMM3-DBA-ADDR2MM3-DBA-ADDR4CityCounty PostalcodeCountryPhoneOpen_DateCancel_DateFirst_Post_DateLast_Post_DateAccount_IDI want to join this temp table onto a temp table called #mids.Within that table i have the following columns FDMSAccountNoExternal_IDParentsfidDBA NameLegal NameStreetMM3-DBA-ADDR2MM3-DBA-ADDR4CityCounty PostalcodeCountryPhoneOpen_DateCancel_DateFirst_Post_DateLast_Post_DateAccount_IDEdfmdaccountnoEexternalno
bandi
Master Smack Fu Yak Hacker
2242 Posts
Posted - 2013-08-16 : 06:33:39
We can easily do a simple JOIN.. what are the common column names between the two tables....
SELECT FDMSAccountNo ,External_ID ,Parentsfid ,DBA Name ,Legal Name ,Street ,MM3-DBA-ADDR2 ,MM3-DBA-ADDR4 ,City ,County ,Postalcode ,Country ,Phone ,Open_Date ,Cancel_Date ,First_Post_Date ,Last_Post_Date ,Account_ID ,Edfmdaccountno ,EexternalnoFROM #EmaxAddress E JOIN #mids m ON E.CommonColumnName = m.CommonColumnName
--Chandu
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2013-08-16 : 13:31:51
depends on how you want to merge the results. it can be a join as per earlier suggestion or you could use union all------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs