Solved

Left Join makes data null?

Posted on 2016-08-02
7
39 Views
1 Endorsement
Last Modified: 2016-08-02
Doing a simple left join of two tables, I do this all the time, but today it's turning the joining table's data null.  

SELECT ThirdTier.*, ThirdOrg.Type as Type
INTO Third
FROM ThirdTier
Left JOIN ThirdOrg
ON ThirdOrg.Location=ThirdTier.SID

The data from ThirdTier is fine, the data from ThirdOrg becomes all <NULL>.

If I switch ThirdTier and ThirdOrg, the opposite happens.  ThirdOrg data is fine, ThirdTier data is all null.  WTH?!  Please help.
1
Comment
Question by:H2Omike
  • 3
  • 3
7 Comments
 
LVL 12

Assisted Solution

by:Dustin Saunders
Dustin Saunders earned 250 total points
ID: 41739964
It returns null if there's nothing joined, so something isn't lined up.  If you can post more info about the tables/columns that would be helpful.
0
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 250 total points
ID: 41739966
what happens when you do a simple SELECT, without the make table?

Are you certain that ThirdTier.SID is supposed to map to ThirdOrg.Location?  Is that supposed to be LocationID?
1
 

Author Comment

by:H2Omike
ID: 41739978
If I do a select without creating the table the same thing happens.  Yes, the columns are correct, LOcation=SID.

See the table design and data snips
ThirdOrg.PNG
ThirdTier.PNG
thirdTierData.PNG
ThirdOrgData.PNG
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:H2Omike
ID: 41739982
OMG.. I figured it out....
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 41739989
Well ???
0
 

Author Comment

by:H2Omike
ID: 41739990
matching the wrong columns like an idiot.  Long day...
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 41740055
Happens to all of us, Mike.
1

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now