by 디비초보 [SQL Query] mariadb sql connectby [2018.01.17 15:05:28]
제목 그대로 mariadb로 1월 1일부터 12월 31일까지 뽑을수 있나요???
테이블은 따로 없고 dual에서 뽑았으면 합니다. 출력은
day
18.01.01
18.01.02
18.01.03
18.01.04
.
.
.
.
이런식으로 뽑고 싶습니다. 오라클에서는 connect by를 이용했었는데 mariadb에는 그게 없어서요... 어떻게 하면 좋을까요???
시퀀스 엔진이 있나요? 있다면.. select date_format(date_add('20180101', interval seq-1 day), '%y.%m.%d') from seq_1_to_365; 시퀀스 엔진이 없다면... select date_format(date_add('20180101', interval seq-1 day), '%y.%m.%d') as dt from (select @num := @num + 1 as seq from information_schema.tables a , information_schema.tables b , (select @num := 0) c limit 365 ) t ;