A method for performing a query on records in a table is disclosed. The
table has at least a first field, a second field and a third field. The
query is for obtaining an aggregate result on the third field of records
for at least one combination of the first and the second fields. The
method includes receiving a query involving a single query statement.
This query statement includes at least one built-in function
corresponding to the second field of the combination. Each built-in
function includes a mathematical formula that selects only a third field
of records whose second field equals the second field of the combination.
The method also includes executing the query statement to produce the
aggregate result.