Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 12890

How to identify when there is a break in continuity of an integer

$
0
0

Hi guys, 

Can you give me an idea on how to solve the following issue?

column01       column02       column03       column04      

1                    001                 002                  0                      

2                    003                 004                  0

3                    009                 010                  1

4                    015                 018                  1

5                    019                 020                  0

so basically the fourth column (column04) is what I want to get if I am given the three columns. The flag 0 or 1 will be applied in the forth column if column02 is not a follow up number of the previous row's column03 value. 

example, column04 is o for the second row because column03 os the first row is 2 and column02 of the second row is 3...hence 3 is the next number to 2.

thanks in advance


ebro


Viewing all articles
Browse latest Browse all 12890

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>