Is there a possible way to do this:
I want to update a field 'rank' according to the ORDER BY place.
For example: (pseudocode)
If id order by place = 1 then update rank field to place were id=get id
rank place id
1 1 5 PC
2 2 8 MAC
is this possible?
Something like this?
UPDATE tbl_name SET rank = 1 WHERE id = ( SELECT id WHERE condition ORDER BY place DESC LIMIT 1 )
Or from your comment (I think MySQL http://dev.mysql.com/doc/refman/5.0/en/update.html):
UPDATE tbl_name SET rank = 10 WHERE id = 9 ORDER BY wins DESC LIMIT 1
You can always do a SELECT to check if these are the records you wish to UPDATE as well:
SELECT * FROM tbl_name WHERE id = ( SELECT id WHERE condition ORDER BY place DESC LIMIT 1 )
SELECT * FROM tbl_name WHERE id = 9 ORDER BY wins DESC LIMIT 1
Some RDBMS have a ROWNUM pseudocolumn in queries you can use for this. You did not specify what database you are using, for example Oracle has this.