Delete from KURUMLAR where KURUMLARID in (

Select MAX(KURUMLARID) as ID
From KURUMLAR 
Group By KODU 
Having Count (KODU) > 1
)
Select KODU as KLN, Count(KODU) as ADET , MAX(KURUMLARID) as ID
From KURUMLAR 
Group By KODU 
Having Count (KODU) > 1