I have a table in the form:
username | role
---------+------
name1 | internal
name1 | admin
name2 | internal
name3 | admin
name4 | external
I need to find all users who have the role of "internal" or "admin", but do not have both (essentially XOR). How to do it in SQL?
A query that results in a form similar to the one below would be ideal:
username | internal | admin
---------+----------+-------
name2 | 1 | 0
name3 | 0 | 1
If this helps, I use the Oracle database
source
share