How to sort values in columns and update table?

前端 未结 7 2541
花落未央
花落未央 2020-12-05 15:28

I\'m completely new to sql and can\'t do that myself. So I need your help. I want to sort values in column and then save changes. But I don\'t know how to do that.

T

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-05 15:41

    You can use the ROW_NUMBER ranking function to renumber the rows.

    SELECT UnsortedId = id
    , SortedId = ROW_NUMBER() OVER (ORDER BY g.name, g.id)
    FROM games 
    

提交回复
热议问题