Professional Web Applications Themes

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. #1

    Default 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. #2

    Default 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. #3

    Default 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

Similar Threads

  1. ranking in mysql query
    By toffee in forum MySQL
    Replies: 2
    Last Post: July 8th, 08:34 PM
  2. ASP/SQL Ranking Query
    By Bob Barrows in forum ASP Database
    Replies: 3
    Last Post: August 8th, 10:59 AM
  3. sorting and ranking
    By Mike Painter in forum Microsoft Access
    Replies: 1
    Last Post: July 8th, 05:46 PM
  4. Combo box and ranking
    By FatMax in forum Microsoft Access
    Replies: 1
    Last Post: July 5th, 03:21 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139