'Control on SQL join condition when there are more than one matching row
I have a join with more than one matching row. How can I have more control over the join? In particular, as shown in the example, when there is more than one matching row, I don't want to obtain any result and maintain my input.
In the picture, I am showing the desired result. The row with the green color is correctly obtained because of directing matching and the row with the red color is also correctly not obtained, because there are more than one matching.
Select t2.id, t1.Insurance_num, t1Name, t1.Surname
From Table_1 t1
left join Table_2 t2
on t1.Insurance_num=t2.Insurance_num
I am using Hive, but I guess the answer to this question should be a generic one.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

