I have 2 numbers, a low and high - I need to return the numbers in between the low and high in a SELECT statement in 2 different formats.
Example:
Low: 3
High: 12
First format (each number is its own row)
SchoolID Grade
5 3
5 4
5 5
5 6
5 7
5 8
5 9
5 10
5 11
5 12
Second format (1 row, 2 columns)
SchoolID GradeLevels
5 3,4,5,6,7,8,9,10,11,12
I will always know what the low and high are beforehand. The second format I would preferably like to encapsulate into a function so that I can pass the low and high to the function and be able to return the comma delimited list into an existing query.
Start Free Trial