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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Join Help

Author  Topic 

masond
Constraint Violating Yak Guru

447 Posts

Posted - 2013-08-16 : 06:17:24
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
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
,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

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 MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -