MySQL- Trigger updating ranking -


i'm creating db "team" table nfl teams, , have assigned them ranking (standing in nfl), attribute called "ranking".

i want create trigger such if ranking updated, of others updated appropriately.

however, can't figure out way loop through table. example, assume team @ rank 5 moves rank 3, how rank 3 become 4, , 4 5?

if need more info, feel free ask, i'll provide asap.

if know id of team update (lets call 42) , old , new rank (old: 5, new: 3), it's not hard:

update team set rank=rank+1 rank between 3 , 5; update team set rank=3 id=42; 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -