001 | 9441 | P021948
001 | 9442 | P021948
001 | 9443 | P021950
001 | 9444 | P021951
001 | 9445 | P021952
001 | 9446 | P021948
In the above table I am looking to COUNT the third column so long as it is outside of the second column's value by (+/- 1).
In other words, I am trying to achieve a count of 2 for P021948 because values 9441 and 9442 are within 1 of each other and record 9446 is outside of that range. My intent is to achieve a total count of 5 given these conditions.
How could I go about querying?
Any advice is greatly appreciated!