Avatar of yanci1179
yanci1179
 asked on

T-SQL Select Statement Without a cursor

I have a total set of records of 1036, I need to find an even range distribution by 6

So without a cursor, how do I get this result.  

1:              1      1036
2:      1037      2073
3:      2074      3110
4:      3111      4147
5:      4148      5184
6:      5185      6221

The second set of numbers is always adding 1036 in order for all 6 records to have even distribution of 1036.
I can do this with a cursor, I can also do it without a cursor and using several parameters, but I wanted to know if this could be done with just one select statement
Microsoft SQL Server 2008

Avatar of undefined
Last Comment
yanci1179

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Arifhusen Ansari

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
yanci1179

ASKER
Thanks!  one more thing....how would I get the 1,2,3, 4,5,6 part?

1:              1      1036
 2:      1037      2073
 3:      2074      3110
 4:      3111      4147
 5:      4148      5184
 6:      5185      6221
SOLUTION
Scott Pletcher

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Vitor Montalvão

yanci1179, do you still need help with this question?
yanci1179

ASKER
Thank you both!
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy