I have a table called stocktransfer Rows truncated to keep it simple here. as per the image the problem with the record is that there is duplicated transaction number across two different invoice number which is incorrect to context of how business logic is. So duplicate transaction is expected as long as it is under the same invoice number. I wrote this query but it does not help since the duplication is expected.
Select strefno,sttran,STDATE,count(sttran)
From postfrh
Group By sttran,strefno,STDATE
Having Count(sttran) >1
Order By sttran
Can anyone please help with how to write a logic to find duplicated transaction where invoice numbers are different two.