Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 15930

Displaying sequence of numbers

$
0
0

Hi,

I need one sql query for displaying following scenario.My source table has one column containing values like

EMP NO

1

2

3

5

9

i want an output like

EMPNO From  To

1            1      3

5            5      5

9            9      9

Means If it is in sequence no's then it has to display starting value and sequence ending value.if it is not sequence it has to display same no for from and to.

Thanks,

Srinivasa



Viewing all articles
Browse latest Browse all 15930

Trending Articles



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