I work on SQL server 2012 I need to delete rows that not have parent code type and parent code value
drop table #MappingCodeValue
drop table #TradeCode
create table #MappingCodeValue
 id int identity (1,1),
 ParentCodeType  nvarchar(50),
 ParentCodeValue  nvarchar(50),
 ChildCodeType  nvarchar(50),
 ChildCodeValue  nvarchar(50)
 INSERT INTO #MappingCodeValue

 --select * from #MappingCodeValue
 TradeCodeId int identity(1,1),
 PartId  int,
 CodeType  nvarchar(50),
 CodeValue nvarchar(50),
 PartDone  bit
 insert into #TradeCode(PartId,CodeType,CodeValue,PartDone)VALUES
what i try is

;with mycte as (
 select Partid from #TradeCode t where PartDone=1
 group by Partid 
having (count(*)=1)

delete t 
from  #TradeCode t 
join mycte m on m.Partid=t.Partid

select * from #TradeCode
Expected result after delete
TradeCodeId    PartId	CodeType	CodeValue	PartDone
1	        1222	ECCS-US  	 AB123-US	   null
2	        1255	ECCS-US	         AB555-US	   null
3	        1222	ECCS-URB	 AB123-URB   	   1
4	        1255	ECCS-URB	 AB555-URB	   1
11	        1255	HTS-US	         AB900-US	   null
12	        909	HTS-US	         AB900-US	   null