range query
AlfioSep 3 2008 — edited Nov 2 2010 I have a table:
CREATE TABLE TEST
(
name VARCHAR2(10 BYTE),
num NUMBER
)
select * from test order by num;
name, num
A, 1 *
B, 4
C, 8
D, 18 *
h, 21
E, 34 *
f, 35
t, 36
L, 51 *
Z, 55
I need a query to get records where the num value >= previous got num value + 15
(the records to find are marked with *)
The first record is always valid.
In the example above, I don't get record (C, 8) because the difference with num value of record (A,1) is less then 15,
but i get record (L, 51) because the difference with num value of record (E,34) is more then 15.
thanks