私のwhere exists条項が機能していません。私が見逃している些細なことは何ですか?
select * from patient as p
where exists
(
    select p.patientid, count(*) from tblclaims as c 
    inner join patient as p on p.patientid=c.patientid
    and p.admissiondate = c.admissiondate
    and p.dischargedate = c.dischargedate
    group by p.patientid
    having count(*)>500
)
クエリでわかるように、patientとtblclaimsは3フィールドの複合キーによって結合されます。