Help Linking Tables in SQL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • webbeacon
    New Member
    • Dec 2015
    • 30

    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
    Code:
    ON (t1.EMP_ID = t2.EMP_ID) AND (t1.DamLev = t2.MinDamLev);
    to two field values like these?
    Code:
    ON table1.column = table2.column;
    Last edited by NeoPa; Jan 18 '16, 06:43 PM. Reason: This question has been split away from the original thread as threads may only contain a single question - NeoPa.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    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"

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32645

      #3
      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.

      Comment

      • webbeacon
        New Member
        • Dec 2015
        • 30

        #4
        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 :/

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32645

          #5
          No worries Jen. If you get it together you can come back in here and post the details.

          Comment

          Working...