Hibernate Criteria - Exclude records with same id but different attribute values

Posted by Aris on Stack Overflow See other posts from Stack Overflow or by Aris
Published on 2009-09-30T22:22:03Z Indexed on 2010/03/24 8:03 UTC
Read the original article Hit count: 287

Filed under:
|

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

© Stack Overflow or respective owner

Related posts about hibernate

Related posts about criteria