delete from QualityAudit_PersonQuality where PersonId in (select PersonId from SitePerson_Person where IdentityCard is null) go delete from Training_TestRecordItem where TestRecordId in (select TestRecordId from Training_TestRecord where TestManId in (select PersonId from SitePerson_Person where IdentityCard is null)) go delete from Training_TestRecord where TestManId in (select PersonId from SitePerson_Person where IdentityCard is null) go delete from SitePerson_PersonInOut where PersonId in (select PersonId from SitePerson_Person where IdentityCard is null) go delete from Training_TaskItem where PersonId in (select PersonId from SitePerson_Person where IdentityCard is null) go delete from Training_Task where UserId in (select PersonId from SitePerson_Person where IdentityCard is null) go delete from SitePerson_Person where IdentityCard is null go