I am trying to get the distinguish column depending on another column's value. I was trying to approach with CASE function but could not get exactly what I wanted.
Condition
- if ColB has only 1 then online
- if ColB has only 2 then offline
- if ColB has both 1 and 2 then both
- if ColB does not have 1 or 2 then none
ColA | ColB |
---|---|
A | 1 |
A | 2 |
A | 1 |
B | 1 |
B | 1 |
C | 3 |
D | 2 |
D | 2 |
The result should be like this
ColA | distinguish |
---|---|
A | both |
B | online |
C | none |
D | offline |
Thanks!