Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/11/2022 in all areas

  1. FYI, if you're using Mysql 8.0 series you can simplify the query by using the window function. One of rank, dense_rank, or row_number would probably give you what you want. For example: SELECT name , total_received , total_donated , rank() over (ORDER BY total_received DESC, total_donated ASC) as the_rank FROM donation rd1 WHERE total_participant = 1 ORDER BY the_rank; | name | total_received | total_donated | the_rank | | ------- | -------------- | ------------- | -------- | | Dasher | 500 | 250 | 1 | | Cupid | 400 | 370 | 2 | | Prancer | 400 | 370 | 2 | | Comet | 380 | 370 | 4 | | Dancer | 200 | 510 | 5 | | Vixen | 100 | 200 | 6 | | Donner | 100 | 510 | 7 | If you're not on Mysql 8.0, you'll have to stick with Barands way.
    1 point
This leaderboard is set to New York/GMT-05:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.