I need some help if you have a second, minute, chunk of time, can you give me some guidance.
Here is what I want
I want to roll back a number, basically do a wrap, problem is the field is rolling, let me describe in a series of examples
Day 1
Sequence 561,562,563,564,565&.. 763,764,765 high number 765, low number 561
Day 2
Old numbers dropped, new numbers added
Sequence 697,698,699,700&.. 777,778,779,780 high number 780, low 697
Day 3
More old numbers dropped, more new numbers added
Sequence 719,720,721,722&.792,793,7
94
When the high number gets to 999 I want to wrap it back down so that the lowest number in the sequence is 1 and the highest is 1+the difference between the two ends of the number line..
So
951,952,953,954&.997,998,9
99
Would become 1,2,3,4&47,48,49
The range is not guaranteed, so it may be
917,918,919&997,998,999
To
1,2,3,4&.81,82,83
This is to keep the numbers in the same relative order, but reduce the value of the number
The math involved is
NewNumber=CurrentNumber-(O
riginalLow
Number-1)
Then we have to set a field in the profile that keeps track of the hightest number to the new high number
So what we would have to do
1. Look up the lowest,positive Number (select top 1 Number from Table where Number>0 order by Number)
2. Read through the table and update the Number field (Update Table set Number = Number-((result of step 1) - 1)
3. Look up the new, highest Number (select top 1 Number from table order by Number desc) OR keep track of the high number
4. Update the profile (update Profile set HighNumber = (result of step 3)
basically, what i need is some quidance on syntax to accomplish this.
thanks!
Start Free Trial