Mysql에서는 재귀호출함수가 없어서 날짜 더미테이블 생성할때는 이게 제일 간단한듯..
select dt.yyyymmdd
from (
select curdate() - INTERVAL (a.a + (10 * b.a) + (100 * c.a)) DAY as yyyymmdd
,a.a as aa
,b.a as ba
,c.a as ca
from (select 0 as a 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) as a
cross join (select 0 as a 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) as b
cross join (select 0 as a 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) as c
) dt
where dt.yyyymmdd between '2015-07-10' and '2015-07-15'
댓글 없음:
댓글 쓰기