in reply to Multidimensional Array Iteration?

This sounds like an SQL question so far; you can do pretty complicated stats and such without ever leaving the DB. Sample input (meaning schema info probably) and desired output would be more likely to get feedback, advice, or sample code.