Tekrar Eden (Mükerrer) Stokları Silmek
;WITH STHARCTE(STOK_KODU, FISNO,STHAR_TARIH, STHAR_GCKOD,STHAR_GCMIK, STHAR_NF,STHAR_ACIKLAMA,STHAR_FTIRSIP, Ranking)
AS
(
SELECT
STOK_KODU, FISNO,STHAR_TARIH, STHAR_GCKOD,STHAR_GCMIK, STHAR_NF,STHAR_ACIKLAMA,STHAR_FTIRSIP,
Ranking = DENSE_RANK() OVER(PARTITION BY STOK_KODU, FISNO,STHAR_TARIH, STHAR_GCKOD,STHAR_GCMIK, STHAR_NF,STHAR_ACIKLAMA,STHAR_FTIRSIP ORDER BY NEWID() ASC)
FROM TBLSTHAR
)
--SELECT *
DELETE
FROM STHARCTE
WHERE Ranking > 1