Welcome to the Monastery | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Yeah, some more details on the db architecture would be very useful since this seems like more of a query issue than anything else. While I can envision a number of ways that an area would have a 1..n relationship with the statistics, I'm just going to have to guess at the field layout (note, I'm not even getting into normalisation): -------------------- -------------------- | Areas | | Stats | -------------------- -------------------- | PersonId | | PersonId | | Person | | Person | | Group | | Stat | -------------------- | MonthKey | -------------------- Assuming that your setup looks anything like this, then there are several ways to query this table for an ordered list of stats. If you wanted everything ordered by date (so no rollup) it would be:
If you wanted to get a date range it would be:
And so on. The output from this query would be quite easy to work with in Perl because you can run through the output without worrying about order:
Hope that helps -- it was a bit of a speculative jump based on the available information, but dbs are designed for querying, sorting, and ordering in clever ways that require you to be a true programming god to reproduce in Perl with anything like comparable performance. In reply to Re^3: Finer points of Class::DBI
by jreades
|
|