728x90
※ ORACLE 사용방법
-
SELECT TO_CHAR( TO_DATE('01', 'DD') + ROWNUM-1, 'DD') AS DAY
FROM DUAL
CONNECT BY level <= 31
※ MySQL 사용방법
-
WITH RECURSIVE CTE AS (
-
SELECT 1 AS DAY
-
UNION ALL
-
SELECT 1+CTE.DAY AS DAY
-
FROM CTE
-
WHERE CTE.DAY <= 31
-
)
-
SELECT * FROM CTE
728x90
'DataBase > MySQL' 카테고리의 다른 글
Mysql / MariaDB] Mysql에서 TIMESTAMP사용방법 (0) | 2020.08.31 |
---|---|
Mysql / MariaDB] Mysql에서 ROLLUP사용방법 (0) | 2020.08.31 |
Mysql / MariaDB] Mysql에서 ROWNUM사용방법 (0) | 2020.08.31 |
Mysql Error ] SQL Error [1093] [HY000]: (conn:8) Table 'TB_SY_ACCES_LOG' is specified twice, both as a target for 'INSERT' and as a separate source for data (0) | 2020.08.31 |
Mysql / MariaDB ] 문자열 붙이기 (0) | 2020.08.31 |