Partition function
Hi, I thought this might be of interest to you:-
Source of Info MS Help
You can use the Partition function in the query design grid as well as in the SQL view of the Query window. In the query design grid, you
can use the Partition function in a calculated field or to specify criteria for a select query.
The following example shows how you can use the Partition function to create a calculated field that lists how many records fall into
each specified range. Suppose you have an Orders table that contains a Freight field. In the Query window, create a new Totals query
by adding the Orders table and clicking on the Totals button in the Query command bar. Drag the Freight field to the first Field cell on
the query design grid, and set the value of the Total cell to Count. In another field cell, enter the following expression.
Range: Partition([Freight], 0, 1000, 50)
Set the Total cell below this field to Group By, and run the query. The Partition function returns eleven ranges (0:99, 100:199, 200:299,
and so on). The query shows the number of orders with freight charges falling into each range.
The next example shows how you can use the Partition function in the SQL view of the Query window. It creates a crosstab query that
evaluates a Freight field in an Orders table. It calculates the number of orders for each customer for which freight cost falls within one of
several ranges. The ranges are defined by the arguments to the Partition function: start = 0, stop = 1000, interval = 50.
Enter the following expression in SQL view. When you run this query, each range will appear as a column heading.
TRANSFORM Count(Orders.[OrderID]) AS [CountOfOrderID]
SELECT Orders.[CustomerID]
FROM Orders
GROUP BY Orders.[CustomerID]
PIVOT Partition(Int([Freight]), 0, 1000, 50);