A challenge for MySQL experts

    Good afternoon, I came across a problem that was simple in appearance, but to solve which you need to move your brains well :)

    So: we have the following table:
    idratingplace
    186Null
    25Null
    35Null
    441Null
    51Null
    691Null


    It is necessary to put down a place in the rating of each record, based on points (rating), and if the points coincide, use a secondary attribute (in this case, id). As a result, you need to get the following table:

    idratingplace
    1865
    252
    353
    4414
    511
    6916


    Important note: the answer must be a single UPDATE query (you can use nested SELECT queries).

    Waiting for suggestions :)

    Also popular now: