I've a table with approximately more than a million records. Few of the sample values are given below:
Group MemberNo
ABC 100
ABC 101
ABC 200
ABC 201
ABC 202
ABC 203
XYZ 100
XYZ 101
ABC 204
XYZ 301
XYZ 302
ABC 500
ABC 600
I wish to group continuous range of values with same group into a sets like this:
Group FromMemberNo ToMemberNo
ABC 100 101
ABC 200 204
XYZ 100 101
XYZ 301 302
ABC 500 500
ABC 600 600
Please see from the above table that since 100 and 101 are continuous it has been grouped into one record ABC 100 to 101. I've tried this thread and is working fine for me. But it is taking quite a long time than desired.
Please help me to achieve this.
Thanks in advance.