troubleshooting Question

SQL/Excel Join Multiple Tables

Avatar of indigo6
indigo6 asked on
Microsoft SQL ServerMicrosoft ExcelSQL
18 Comments1 Solution519 ViewsLast Modified:
     I was recently tasked with merging multiple "databases" that contain mailing information. They are actually excel sheets with slightly different layouts, but I imported them into SQL because I thought it was a clever solution to my problem. Turns out I was wrong.

Here is a basic overview of the data each excel file contains. Each excel file contains mailing information such as First Name, Last Name, Address, etc. The important part of each file is the mailing "Code," this code represents what group the person belongs to.

There are many people who appear in multiple files, and so they have multiple codes. Because of this, I need each person to appear with all relevant codes in the same row. So what I did initially is to import each file into its own SQL table, and then I did a number of full joins on each table for First Name AND Last Name. Like this:
ON LIST1$.FName = LIST2.FName AND LIST1$.LName =  LIST2.LName
ON LIST2.FName = LIST3.FName AND LIST2.LName = LIST3.LName
And then this continues on for about 5 more tables.
This gives me the structure I want, but some people who show codes from LIST1 and LIST2 in the same row, but then they appear again in another row with LIST3 as the code, even though the LName and FName matches that in LIST1 and LIST2. There is also a massive section of NULL rows near the end.

Perhaps doing it through SQL is the wrong way, and I'm open to any suggestions, I just need to get these joined and organized. Any help is appreciated! Thank you!
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 18 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros