Avatar of hackman122

asked on 

SQL Question


I have a table with the following columns and data:

 BatchID ClaimID   ClaimStatus
   1          1A             Success
   1          1B             Success
   2          2A              Fail
   2          2B              Fail
   3         3A              Success
   3      3B              Fail

I would like to select the batches that have no claims failed.

In this case I would only want batch 1, because all the claims have status = success. I don't want batch 2 because both claims have status = fail and I don't want batch 3 because 1 of the claims has status = fail.

There could be multiple claims in a batch. That means that even if I had a batch with 10 claims and 9 had status = success and 1 had status = fail, I would not want to select that batch.

Help please :)

Microsoft SQL ServerMicrosoft SQL Server 2008Databases

Avatar of undefined
Last Comment

8/22/2022 - Mon