0
A
回答
1
你可以用update
做到这一点,假设id
是每行独特:
update players
set place = p.new_place
from (select p.*, row_number() over (order by score) as new_place
from players p
) p
where players.id = p.id;
1
UPDATE players
SET place=ordered_place
FROM (SELECT id, 'place' AS ordered_place
FROM players
ORDER BY score
) AS t1
WHERE players.id=t1.id;
相关问题
- 1. PostgreSQL,存储过程的lo_export查询
- 2. PostgreSQL存储函数与多个查询
- 3. PostgreSQL的存储过程:我想查询
- 4. 查询顺序
- 5. 在PostgreSQL中查找日期顺序
- 6. 存储多个数组值与顺序
- 7. 存储库 - 在本机查询顺序不起作用
- 8. TSQL加入,查询处理顺序和存储
- 9. 检查postgresql中的返回查询中是否存在值
- 10. 从查询中存储计数值
- 11. 从查询中存储值PHP MYSQL
- 12. 在SQLite中存储/查询多个值
- 13. 如何查询存储在不同表中的自定义排序顺序?
- 14. 使用postgresql将整个查询结果存储在变量中存储过程
- 15. SQL查询顺序
- 16. 顺序SQL查询
- 17. 查询PostgreSQL中
- 18. 查询PostgreSQL中
- 19. 将查询输出存储到Redshift中的变量Postgresql
- 20. 如何在PostgreSQL存储过程中查询原子?
- 21. 存储过程postgresql中,多个查询w /聚合
- 22. 在变量中使用shell脚本存储PostgreSQL查询
- 23. 在PostgreSQL中存储和查询区间树
- 24. PostgreSQL存储过程中的相同查询
- 25. 存储查询
- 26. Rails按特定顺序按多个值激活查询顺序?
- 27. PostgreSQL查询 - 列不存在
- 28. PostgreSql查询数组值
- 29. 需要一个PostgreSQL的查询分组和顺序
- 30. Postgresql jsonb_agg子查询排序