Last active
June 9, 2026 20:42
-
-
Save evokateur/5d1b26e03c6f6ca3e5336c9910677769 to your computer and use it in GitHub Desktop.
A MySQL query that generates integers 1 to 10000, for example (see below for months and years)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT @row := @row + 1 as i FROM | |
| (select 0 union all select 1 union all select 3 union all select 4 union all select 5 union all select 6 union all select 6 union all select 7 union all select 8 union all select 9) t, | |
| (select 0 union all select 1 union all select 3 union all select 4 union all select 5 union all select 6 union all select 6 union all select 7 union all select 8 union all select 9) t2, | |
| (select 0 union all select 1 union all select 3 union all select 4 union all select 5 union all select 6 union all select 6 union all select 7 union all select 8 union all select 9) t3, | |
| (select 0 union all select 1 union all select 3 union all select 4 union all select 5 union all select 6 union all select 6 union all select 7 union all select 8 union all select 9) t4, | |
| (SELECT @row:=0) t5; |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can put these together to generate a periods table for aggregate values from data where all periods aren't represented.