php - Update field if the ORDER BY is 1 descending? -


is there possible way this:

i want update field 'rank' according order place.

for example: (pseudocode)

if id order place = 1 update rank field place id=get id    rank place id    1     1    5   pc   2     2    8   mac 

is possible?

something this?

update tbl_name set rank = 1 id = (      select id      condition      order place desc      limit 1 ) 

or comment (i think mysql http://dev.mysql.com/doc/refman/5.0/en/update.html):

update tbl_name set rank = 10 id = 9 order wins desc limit 1 

you can select check if these records wish update well:

select * tbl_name id = (      select id      condition      order place desc      limit 1 ) 

or

select * tbl_name id = 9 order wins desc limit 1 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -