Comments posted to this topic are about the item Setting Rows to Odd and Even Values
Just a quick note on odd/even numbers. The quickest way to find out if a number is odd or even is to use a modulo function. If you take a number, n, and mod by 2 it returns 0 if even and 1 if odd. For example:
SELECT 3 AS number, 3 % 2 AS IsOdd
SELECT 15, 15 % 2
SELECT 159670, 159670 % 2;
Thanks for your comment. It is true that if you are just trying to determine if a number is odd or even use modulo function.
In my case, as you can see in my article, the issue isn't trying to figure out if something is odd or even, but to force 1,2,3,4,5 to be 1,3,5,7,9
Or to force 1,2,3,4,5 to be 2,4,6,8,10
So then when you sort those rows together the records are interleaved. There is no way to use modulo to do that.
Nicely done, Ben. Awesome simplification of an "interleaving" method using some very straight-forward math.
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)