Wie gesagt, in Query/400 gibt's auch Aggregatfunktionen und Gruppenwechsel.