Link to home
Start Free TrialLog in
Avatar of MichaelSwitzer
MichaelSwitzer

asked on

Group set of number by Min and Max sets

I'm looking for some code or method that will display the min and max of sequenced number sets.
Situation:
I have a table with with record entries like:

1
2
3
4
6
7
8
22
23
24

and i would like an output of:

Min      Max
1           4
6           8
22        24
Avatar of Ray
Ray
Flag of United States of America image

I don't understand the question?  What are you trying to accomplish?
Avatar of MichaelSwitzer
MichaelSwitzer

ASKER

The actual application is a little more complicated than the example I provided... Sorry for the poor reduction...

Assume a table named RawData. In the table RawData, 10 rows exist with the following values:

UniqueID     Column1
    1                  5
    2                  6
    3                  7
    4                  9
    5                 67
    6                 68
    7                 69
    8                 70
    9                 71
   10                72

I am looking for a store procedure or Table-Valued Function that will yield the follow results:


     Min               Max
     5                    7    
     9                    9
    67                  72

Notice the MIN and MAX are the min and max of a CONSECUTIVE set of numbers essentially grouped together.

I hope this helps...

Thank you rlistenb
i understand the solution is multi-part. it probably involves a stored procedure and a scalar-valued function or two...
SOLUTION
Avatar of Mark Wills
Mark Wills
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ee_rlee, I used your solution because it is a bit faster and more eloquent.
Thank you both for your quick responses and help. Great Job!