Hibernate Criteria - Exclude records with same id but different attribute values
- by Aris
Hi,
I'm trying to find records where status = "a" for a Person
but exclude records where the same person has another record with a status="b"
SELECT * FROM Person WHERE STATUS = 'a'
AND Person_id NOT IN (SELECT Person_id FROM Person WHERE STATUS = 'b' AND Person_id IS NOT NULL)
Appreciate the help