# Ranking of results? - Coldfusion - Advanced Techniques

I've got various statistics, some are calculated from a query, which I'm putting into a custom query which I'm running a query of a query on. This works fine, but the next thing I'd like to do is to take the same data and determine the ranking of the various statistics compared to the rest of the data set. So for using baseball for an example, let's say I have Stats Player | At Bats | Hits | Batting Avg Bob | 400 | 100 | .250 Jack | 200 | 75 | .375 Ted | 300 | 125 | ...

1. ## Ranking of results?

I've got various statistics, some are calculated from a query, which I'm
putting into a custom query which I'm running a query of a query on. This
works fine, but the next thing I'd like to do is to take the same data and
determine the ranking of the various statistics compared to the rest of the
data set.

So for using baseball for an example, let's say I have

Stats
Player | At Bats | Hits | Batting Avg
Bob | 400 | 100 | .250
Jack | 200 | 75 | .375
Ted | 300 | 125 | .416

Now I'd like to take this data and determine where players would rank in the
individual categories.

Rank
Player | At Bats | Hits | Batting Avg
Bob | 1 | 2 | 3
Jack | 3 | 3 | 2
Ted | 2 | 1 | 1

Any ideas on the best way to accomplish this? I'm drawing a blank here.

Dave

Dave Guest

2. ## Re: Ranking of results?

This would increase the processing, but off the top of my head.

If you did a QoQ of the QoQ and do an order by the column this would give you
the ranking order for that column, you could then loop through the result set
and insert the ranking into the column.

But you would need to do this for every column you wanted to rank. On the
bright side you could create a custom tag to do this, with this custom tag in a
list loop of the columns to rank and then just pass through the column name.

Ken

The ScareCrow Guest

3. ## Re: Ranking of results?

Yeah that's the only way I could see of doing it but I was hoping there was
a more obvious/elegant way of doing it that I just wasn't seeing.

Thanks Ken

"The ScareCrow" <infokrcaldwell.com> wrote in message
news:d5u5v8\$eeg\$1forums.macromedia.com...
> This would increase the processing, but off the top of my head.
>
> If you did a QoQ of the QoQ and do an order by the column this would give
> you
> the ranking order for that column, you could then loop through the result
> set
> and insert the ranking into the column.
>
> But you would need to do this for every column you wanted to rank. On the
> bright side you could create a custom tag to do this, with this custom tag
> in a
> list loop of the columns to rank and then just pass through the column
> name.
>
> Ken
>

Dave Guest

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•