Forum Discussion

Porkey's avatar
Porkey
Frequent Visitor
3 years ago
Solved

Joining two tables but if column contains nulls join using another column for that row

I dont think this is possible, but i was wondering if it is, ive looked round but cant find an example of it being or not being possible

 

Merge 1 with 2

 

Table 1

Staff IDDepartment ID
1a
2c
nullb

 

Table 2

Staff IDDepatment IDLocation
1aScotland
2cWales
3bEngland

 

 

Outcome

Staff IDDepartment IDLocation
1aScotland
nullbEngland
2cWales

 

So because department B is in england it picks that up rather than where the staff id is based, I wouldnt want to use department ID as certain staff would not be located in the department location so would prefer to pick it up from Staff ID, but where thats missing from department ID instead

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Porkey ,

    Please try to use Right Outer join kind.

     

    Then remove the columns that you don't need.

     

    Best Regards

    Community Support Team _ Polly

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Porkey ,

    Please try to use Right Outer join kind.

     

    Then remove the columns that you don't need.

     

    Best Regards

    Community Support Team _ Polly

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.