I work on SQL server 2012 I need to delete rows that not have parent code type and parent code value
SQL
whatitryis;withmycteas(selectPartidfrom#TradeCodetwherePartDone=1groupbyPartidhaving(count(*)=1))deletetfrom#TradeCodetjoinmyctemonm.Partid=t.Partidselect*from#TradeCode
SQL
TradeCodeIdPartIdCodeTypeCodeValuePartDone11222ECCS-USAB123-USnull21255ECCS-USAB555-USnull31222ECCS-URBAB123-URB141255ECCS-URBAB555-URB1111255HTS-USAB900-USnull12909HTS-USAB900-USnull
Text
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...