Need help!
i need to renumber a sequence of numbers on a couple of records when a record is deleted. example:
Start :
value 2ndvalue
1 5766
2 3333
3 6679
4 8697
5 2845
now i'm deleting the row with the value: 2 so i get:
1, 3, 4, 5
i need to get the numbers back in a sequence as:
1, 2, 3, 4
now i can make it happen by assigning a number (value-1) to each field which comes after 2.
But when a table get really large eg. 34000 and i'm deleting number 2 it needs a lot of changing :-(
is there a way that mysql can do the job, that when the record is deleted, i can give mysql a command to renumber the whole column at once.
Any help would be kindly accepted.
Thx in advance.
i need to renumber a sequence of numbers on a couple of records when a record is deleted. example:
Start :
value 2ndvalue
1 5766
2 3333
3 6679
4 8697
5 2845
now i'm deleting the row with the value: 2 so i get:
1, 3, 4, 5
i need to get the numbers back in a sequence as:
1, 2, 3, 4
now i can make it happen by assigning a number (value-1) to each field which comes after 2.
But when a table get really large eg. 34000 and i'm deleting number 2 it needs a lot of changing :-(
is there a way that mysql can do the job, that when the record is deleted, i can give mysql a command to renumber the whole column at once.
Any help would be kindly accepted.
Thx in advance.