Patent ID: 7062494

Claim:
A computer-implemented method for performing a query on records in a table with at least a first field, a second field and a third field to obtain an aggregate result on the third field of records for at least one selected combination of the first and the second fields, the method comprising; receiving a query involving a single query statement that includes at least one built-in function corresponding to the second field of the selected combination, wherein the built-in function includes a mathematical formula that selects only a third field of records whose second field is equal to the second field of the selected combination, wherein the mathematical formula is: round(((X−mod(Y,X))/X)−0.5)*Z where X is the second field of the selected combination; Y is an occurrence of the second field of a record; and Z is an occurrence of the third field of a record; wherein the second field is obtained from a range having a maximum value that is not more twice a minimum value; executing the query statement to produce the aggregate result; and displaying the aggregate result in a horizontal format which includes a row corresponding to each first field wherein the row includes an aggregate result for each second field.