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

Need SQL to find Consecutive Missing number from table.

$
0
0

I looking for Query which can give me Consecutive missing number from following table

where ColB is Available Year ColC is Starting Point and Currunt Year is End point

Col1 ColB    Col C

A      2012       2007

A       2011       2007

A       20102007

A       20102007

A       20072007


B    20122006

B      20112006

B      20102006

B      20092006

B       20082006

B        20072006

B       20062006

C     20122007

C     20112007

C      20102007

So If I am looking for 2 consecutive missing year for ColA then 

Answer Should 

Col1

---------

A

So If I am looking for 2 consecutive missing year for ColA then 

Answer Should 

Col1

----

C


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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