cusimar9
03-03-2006, 06:38 AM
I have a field in my database that I want to sort by, unfortunately its a calculated field and its too cumbersome to calculate using SQL.
I finally solved it by retrieving all the rows into a multi-dimensional array, and sort it using a modified QuickSort algorithm which does the job very nicely.
Unfortunately, our requirements have now changed so that I need to sort the array on 2 fields.
Now one of the fields I COULD sort using SQL, but then when the QuickSort algorithm sorts on the caculated field it'll jumble up the ordering again.
Can anyone recommend how I might be able to sort on 2 fields?
Maybe I need to modify the QSort algorithm some more to accommodate it...
I finally solved it by retrieving all the rows into a multi-dimensional array, and sort it using a modified QuickSort algorithm which does the job very nicely.
Unfortunately, our requirements have now changed so that I need to sort the array on 2 fields.
Now one of the fields I COULD sort using SQL, but then when the QuickSort algorithm sorts on the caculated field it'll jumble up the ordering again.
Can anyone recommend how I might be able to sort on 2 fields?
Maybe I need to modify the QSort algorithm some more to accommodate it...