I have a table containing a list of indicies and values
OrigTable
Index Value
1 10
2 11
3 16
4 18
5 14
6 11
7 10
8 12
9 20
10 17
I need to use two other tables to separate the values.
Table1 will contain rows from OrigTable where Value is <=15, and
Table2 will contain >15, but also containing one point in either direction such that if index n corresponds to a value above 15, it will be included in Table 2, but so will indicies n-1 and n+1
as such the result will
Table1:
Index Value
1 10
2 11
5 14
6 11
7 10
8 12
Table2:
Index Value
2 11
3 16
4 18
5 14
8 12
9 20
10 17
I haven't been able to determine a way to do this using SQL. Is it not possible, or am I missing some command that would make this doable?
EDIT: 15 would be included in Table 1; I forgot to add 'or equal to'. By 'one point in either direction', I meant that if index n corresponds to a value above 15, it will be included in Table 2, but so will indicies n-1 and n+1