开发者

Query for Updates in database when One of the Column is affected

开发者 https://www.devze.com 2023-03-09 17:37 出处:网络
I have a database with column as points,ranking and some others.When I change the points in t开发者_开发问答he database is it possible to rank all the records based on updated data.I am not entering r

I have a database with column as points,ranking and some others. When I change the points in t开发者_开发问答he database is it possible to rank all the records based on updated data. I am not entering ranks it should be calculated every time when I change the Points column.


I'd suggest do not do any calculations in the DB, it should be done at the Sever. You may do (on MYSQL):

SELECT points FROM TABLE ORDER BY points DESC LIMIT 50;

Then on the server you have a descending order list of points with each you can associate a Rank.

DB is best kept as away as possible from calculations.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号