Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Reading previous row to compare id of the current one (sql server)

I am trying to do the following thing with an SQL database.

Let assume that I have 3 rows lokking like that :
ID Number number 2
120 10 15
121 17 25
121 26 29

when in second row I want to check first row for the value of 'number 2'.

I would like to know if there s a way to check that easily on SQL Server 2000 (through SQL) ?

Thanks for the answer
[470 byte] By [gabh] at [2007-11-11 8:34:15]
# 1 Re: Reading previous row to compare id of the current one (sql server)
Hi,

I don't think you can do that with a simple SQL-statment.
You need a virtual array and perhaps some code th check the data.
Benjamin at 2007-11-11 23:47:08 >