Hallo,
ich denke so sollte es in etwa funktionieren:
PHP-Code:
with b as (Select a.KundeNr, a.Wert,
count(Distinct b.KundeNr concat digits(b.Wert))
as Zaehler
from Umsatz a join Umsatz b
on a.KundeNr = b.KundeNr and a.Wert <= b.Wert
group by a.KundeNr, a.Wert)
select * from b
where Zaehler <= 5
order by b.KundeNr, b.Wert Desc
Birgitta
Birgitta
Bookmarks