Return to Snippet

Revision: 70279
at January 3, 2016 13:09 by ktrout


Initial Code
drop view if exists digits_v;
create view digits_v
as
select 0 as n
union all
select 1 union all select 2 union all select 3 union all 
select 4 union all select 5 union all select 6 union all
select 7 union all select 8 union all select 9
;

-- get sequence 0..9
select 10*a1.n + a0.n
from digits_v a1
cross join digits_v a0
where (10*a1.n + a0.n) < 10
order by 10*a1.n + a0.n + 1
;

Initial URL

                                

Initial Description
one cross join for each ai in definition of decimal number as sum(ai*10^i)

Initial Title
mysql sequence generator ( decimal definition )

Initial Tags
mysql

Initial Language
SQL