Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL - 'smearing' a value

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-12-28 : 11:49:39
Al writes "Hi SQLTeam,


What method might be used to carry a value from
one row of a table to following rows, until a delimiting
value is found, given that there is not a common key
between the value source row and the target rows, but only
their proximity in the table or index.

Thus:


A B C

xx1 value01 yy1

xx3 ----- ee2

xx5 ----- ee8

xx7 ----- yy1


So, the goal is to put the 'value01' into rows 'xx3' & 'xx5',
while stopping at xx7 because it has the delimiter 'yy1' that
matches the value 'yy1' from row 'xx1'.


Another way of looking at this might be to create a
'running balance' in a column of a table where the rows
to be summed together do not have a common key but only
exist within delimiters.


Your opinion?


Al."
   

- Advertisement -