I'm using a numbers matching table, from one upwards. However, I realize I need to start at zero instead. Can't figure it out..
CREATE TABLE IF NOT EXISTS util_nums (n integer primary key
autoincrement not null);
insert into util_nums(n) select null from (select 0 as n union select 1
union select 2 union select 3 union select 4 union select 5 union select 6
union select 7 union select 8 union select 9 union select 10) a
cross join
(select 0 as n union select 1 union select 2 union select 3 union select 4
union select 5 union select 6 union select 7 union select 8 union select 9
union select 10) b
cross join (select 0 as n union select 1 union select 2
union select 3 union select 4 union select 5 union select 6 union select 7
union select 8 union select 9 union select 10) c;