📜 ⬆️ ⬇️

Problem for MySQL connoisseurs

Good afternoon, here I am faced with a task that is simple in appearance, but for the solution of which you need to keep your brains going :)

So: we have the following table:
idratingplace
one86Null
2fiveNull
3fiveNull
four41Null
fiveoneNull
691Null


It is necessary to place a place (place) in the rating of each record, based on points (rating), and if the points are the same, use the secondary sign (id in this case). As a result, you need to get the following table:
')
idratingplace
one86five
2five2
3five3
four41four
fiveoneone
6916


Important note: the answer should be one UPDATE query (you can use nested SELECT queries).

Waiting for suggestions :)

Source: https://habr.com/ru/post/51954/


All Articles