I have a query that, in a perfect world, would pull, for example...
If Bill has 3 rows of data:
•Pending
•Pending
•Active
I'm trying to apply logic where if a patient has an Active status I'd just want that row to display: Active
But if Sara has 3 rows:
•Pending
•Pending
•Pending
I'd want all 3 Pendings to show. Only if the patient has an Active will just the Active show
Right now my results are pulling (for the Bill example above)
•Pending
•Pending
•Active
Instead of
•Active
Here is an example query:
select distinct
MRN
,[RX Number]
,[Status]
from Table1
where Status = case when d.Status = 'ACTIVE' then Status
when d.Status <> 'ACTIVE' then Status end