Query for Updates in database when One of the Column is affected
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.
精彩评论