I got some problems with duplicate rows which I don't wanna get.
Hi! I got two tables - tab1, tab2 and I want to join tab2 to tab1 like:
SELECT t1.column_A1, t2.column_B2
FROM tab1 t1
JOIN
tab2 t2
ON t1.column_A1=t2.column_A2
tab1
| Column A1 | Column B1 | Column C1 |
| -------- | -------- | -------- |
| Z1 | Cell 2 | Cell 3 |
| Z2 | Cell 5 | Cell 6 |
tab2
| Column A2 | Column B2 | Column C2 |
| -------- | -------- | -------- |
| Z1 | PW | Cell 3 |
| Z1 | RW | Cell 6 |
For some rows in tab1 there are more than 1 rows in tab2.
The result will be:
| Column A2 | Column B2 | Column C2 |
| -------- | -------- | -------- |
| Z1 | PW | RE |
| Z1 | RW | KS |
I want to get: if PW - show only one row with PW; if not PW - show only one row with RW
The result should be:
| Column A2 | Column B2 | Column C2 |
| -------- | -------- | -------- |
| Z1 | PW | RE |