SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Join Help
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

masond
Constraint Violating Yak Guru

447 Posts

Posted - 08/16/2013 :  06:17:24  Show Profile  Reply with Quote
Hey guys
Hope your well

I have a temp table called #EmaxAddress which have the following Columns

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

I want to join this temp table onto a temp table called #mids.Within that table i have the following columns
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
Eexternalno


bandi
Flowing Fount of Yak Knowledge

India
2223 Posts

Posted - 08/16/2013 :  06:33:39  Show Profile  Reply with Quote
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
   ,Eexternalno
FROM #EmaxAddress E 
JOIN #mids m ON E.CommonColumnName = m.CommonColumnName


--
Chandu
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 08/16/2013 :  13:31:51  Show Profile  Reply with Quote
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 MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000