Reputation: 11
I have a database as shown below .
------------------
name | position
------------------
a 1
b 2
c 3 .<----
d 4
f 5
I want that when a row is deleted . (Row c)
I know how delete a row . when delet row c: sqlite is blow
------------------
name | position
------------------
a 1
b 2
d 4
f 5
But I do not want this result.
i want to The result is as shown below
------------------
name | position
------------------
a 1
b 2
d 3
f 4
Upvotes: 0
Views: 101
Reputation: 5220
you have to execute this query :
UPDATE myTable
SET position = position - 1
WHERE position > x
replace myTable
with your table name. and replace x
with position of deleted row.
Upvotes: 1