Solved

Left Join makes data null?

Posted on 2016-08-02
7
58 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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

730 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