?
Solved

Left Join makes data null?

Posted on 2016-08-02
7
Medium Priority
?
68 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 13

Assisted Solution

by:Dustin Saunders
Dustin Saunders earned 1000 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 48

Accepted Solution

by:
Dale Fye earned 1000 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
Certified OpenStack Administrator Course

We just refreshed our COA course based on the Newton exam.  With 14 labs, this course goes over the different OpenStack services that are part of the certification: Dashboard, Identity Service, Image Service, Networking, Compute, Object Storage, Block Storage, and Orchestration.

 

Author Comment

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

Expert Comment

by:Dale Fye
ID: 41739989
Well ???
0
 

Author Comment

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

Expert Comment

by:Dale Fye
ID: 41740055
Happens to all of us, Mike.
1

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

765 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