I have a result of a union of two tables like this:
UserId AppId Status
------------------------
A1 5 INACTIVE
A1 5 SUSPENDED
A1 6 REVOKED
A1 6 SUSPENDED
A1 6 ACTIVE
A1 7 REVOKED
A1 8 SUSPENDED
B2 7 INACTIVE
B2 7 INACTIVE
B2 7 ACTIVE
C3 6 INACTIVE
How can I eliminate the rows with duplicate UserId and AppId and return with just one Status, with an order of preference to return: 1. ACTIVE 2. SUSPENDED 3. REVOKED 4. INACTIVE
UserId AppId Status
------------------------
A1 5 SUSPENDED
A1 6 ACTIVE
A1 7 REVOKED
A1 8 SUSPENDED
B2 7 ACTIVE
C3 6 INACTIVE