471,893 Members | 1,361 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,893 software developers and data experts.

Help Linking Tables in SQL

Follow-up question:
{This new question has been split away from the original thread (Find the lowest value in an array of results within a SELECT statement... possible?) as threads may only contain a single question - NeoPa.}
I've realized I should probably be using a LEFT JOIN instead of an INNER JOIN, because I'm getting incorrect records, but how can I use a LEFT JOIN in this case? Is there a way to convert the
Expand|Select|Wrap|Line Numbers
  1. ON (t1.EMP_ID = t2.EMP_ID) AND (t1.DamLev = t2.MinDamLev);
to two field values like these?
Expand|Select|Wrap|Line Numbers
  1. ON table1.column = table2.column;
Jan 18 '16 #1
4 793
Rabbit
12,516 Expert Mod 8TB
I'm not sure what you mean exactly but just change the word inner to left. But it would help if you explain what you mean by "incorrect records"
Jan 18 '16 #2
NeoPa
32,470 Expert Mod 16PB
As Rabbit says - It's going to be hard to follow and help if you don't give some more details as to what's wrong with the results.

My guess, with very little to go on, is that the problem is not related to the type of JOIN used.
Jan 18 '16 #3
Sorry guys - I swear I tested it on Friday and it wasn't working but Rabbit you're absolutely right - just changing the word "inner" to "left" changed the join. NeoPa you're also right; it didn't fix the problem LOL

I need to think through the logic a bit more before I post. Please disregard this and I'll come back later when I'm making more sense :/
Jan 18 '16 #4
NeoPa
32,470 Expert Mod 16PB
No worries Jen. If you get it together you can come back in here and post the details.
Jan 18 '16 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Christoph Sticksel | last post: by
2 posts views Thread by Matthew Wells | last post: by
1 post views Thread by deiopajw | last post: by
4 posts views Thread by trevordixon | last post: by
reply views Thread by YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.