select MUSNO,TARIH,BORC,ALACAK,ISLEMTIPI, 
RANK () OVER (PARTITION BY ISLEMTIPI,MUSNO  ORDER BY TARIH,BORC DESC) SIRA FROM ACARI 
GO
SELECT ISLEMNO,BAACIKLA,COUNT (ISLEMNO) OVER (PARTITION BY ISLEMNO,BAACIKLA ) SAY
FROM ACARI ORDER BY SAY DESC
GO
SELECT * FROM ACARI WHERE ISLEMNO IN (47651,40857,39327) ORDER BY ISLEMNO
go
WITH   ACARICTE
AS
(select MUSNO,TARIH,BORC,ALACAK,ISLEMTIPI, 
ROW_NUMBER () OVER (PARTITION BY ISLEMTIPI,MUSNO  ORDER BY TARIH,BORC DESC) SIRA FROM ACARI )
SELECT * FROM ACARICTE