I have a database from which I need to extract about 15 fields (some as a result of joins), but only need to group hierarchically on 2, and then sort on a couple other fields.
The only way I've found is to group by all 15 fields... and the result is REALLY slow to run (surprise...)
What I am looking for is a way that I can group on each level, so I can iterate over the multiple groupings, but still pick out the non-grouped fields. So far, I always seem to hit one issue or another, eg scope.
Any pointers welcome, (preferably in query syntax)