﻿SELECT SUM(a1.Betrag)
FROM gkvtransferprotokoll AS t1
JOIN gkvabrechnung a1
ON a1.Oid = t1.GkvAbrechnungOid
WHERE DATE(t1.ErstelltAm) >= ?
AND DATE(t1.ErstelltAm) <= ?
AND t1.Oid = (
SELECT MIN(Oid)
FROM gkvtransferprotokoll AS t2
WHERE t1.GkvAbrechnungOid = t2.GkvAbrechnungOid
GROUP BY t2.GkvAbrechnungOid
)