I have a player stats table with a points field.
I want to update the rank in this using a single query based on the points
in the row.
I am not that good at complex sql but I have managed to get the result I
want from the following select query.

SELECT points,(SELECT COUNT(*) FROM stats b WHERE b.points >= a.points ORDER
BY points ASC) AS rank FROM stats a

Here is the resulting data.
playerid, points, rank
1, 200, 4
2, 800, 1
3, 600, 2
4, 400, 3

This gives me a list of all points and their rank correctly.
What I actualy need is an update query along the same lines but I realy
don't know what I am doing.
Can anyone help or point me in the right directions.
Many thanks
-- 
View this message in context: 
http://www.nabble.com/Updating-rank-field-by-points-in-stats-table.-tp18146541p18146541.html
Sent from the SQLite mailing list archive at Nabble.com.

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to