Consult everybody, have to cancel the logo data, statistical PatientID, now need to have the same PatientID but have cancel logo cancel each other out, have no idea, please comment,
CodePudding user response:
select distinct PatientID from tableA a where not the exists (select top 1 1 from tableA where PatientID=Amy polumbo atientID and charindex (' cancel ', ItemName) & gt; 0)