Skip to content
Advertisement

Exclude records where particular value exists in related record

The below dataset displays the audit trail of a “review” record that has gone through a number of statuses.

What I’m trying to achieve is only display the case ids where the auditcasesubstatusname is one of (‘Checklist Complete’, ‘All Documents Available’, ‘Review Complete’) and does not have a value of (‘Missing Document No Action’, ‘Missing Document Action Required’, ‘Referral Request’)

In this example, case id 1 would be returned but not case id 41 due to it having a value of “Referral Request”

Having a real coders block right now so not sure how to best achieve this in SQL Server. Any ideas?

Thanks

Advertisement

Answer

I think you can try this:

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement