반응형
select a.Date
from (
select curdate() - INTERVAL (a.a + (10 * b.a) + (100 * c.a)) DAY as Date
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
) a
where a.Date between '2017-04-01' and '2017-04-30'
/* between의 날짜는 오늘날짜에서 1000일 이내어야 함. */
728x90
반응형
'Database ( DB ) > Database' 카테고리의 다른 글
[oracle] COUNT(*) 를 빠르게 하는 방법 (0) | 2019.08.10 |
---|---|
[MySQL] COUNT의 잘못된 인식과 속도 차이 (0) | 2019.08.10 |
DB key값이 무조건 대문자로 return 될 때 해결 방법 (0) | 2019.08.10 |
[mariaDB, MySQL] DB 연결 속도저하 해결 방법 (0) | 2019.08.10 |
[mysql/mariadb] DB 스케쥴러 (0) | 2019.08.10 |