Just for the example: CREATE TABLE example ( id INTEGER PRIMARY KEY, sort INTEGER ); Lets say both columns have the same values, numbers from 0 to 100: id pos 0 0 1 1 2 2 3 3 etc... Suppose I want to change id 98 to position 2: UPDATE example SET pos = 2 WHERE id = 98; UPDATE example SET pos = pos+1 WHERE id != 98 AND pos => 2 AND pos < 98; Is there any better way?