| Posted by Jens on 11/03/05 14:28 
--Create the other column
 ALTER TABLE #tempone ADD SomeCalcValue REAL NULL
 
 UPDATE #Tempone SET
 col3 =
 ((SELECT TOP 1 SomeValue
 FROM #Tempone T2
 WHERE T1.SomeId = T2.SomeID
 AND T2.SomeValue > T1.SomeValue
 ORDER BY SomeValue  )
 / (CASE SomeValue WHEN 0 THEN NULL ELSE SomeValue
 END)-1)*100
 >From #Tempone T1
 
 But what I already mentioned and David mentioned is the sequence in
 which the calculations is done in place, because in your sample data
 there was no structure to find any logic of the sequence in there.
 
 BTW, Call me Jens :-D
 
 HTH, jens Suessmeyer.
  Navigation: [Reply to this message] |