Vote count:
0
There is my problem, I have a table like this:
Company, direction, type, year, month, value, rank
When I create the table, rank is 0 by default, and what I want is to update rank in the table using this select:
SELECT company, direction, type, year, month, value, rank() OVER (PARTITION BY direction, type, year, month ORDER BY value DESC) as rank
FROM table1
GROUP BY company, direction, type, year, month, value
ORDER BY company, direction, type, year, month, value;
This Select is working fine, but I can't find the way to use it to update table1
I have not find any answer solving a problem like this with this kind of sentence. If someone could give me any advice about if it is posible to do or not I would be very grateful.
Thanks!
asked 1 min ago
SQL UPDATE in a SELECT rank over Partition sentence
Aucun commentaire:
Enregistrer un commentaire