써먹는 웹개발
[Mysql] 0 ~ 999까지 더미 테이블 생성하는방법 본문
SELECT
SEQ.SeqValue
FROM
(
SELECT
(HUNDREDS.SeqValue + TENS.SeqValue + ONES.SeqValue) SeqValue
FROM
(
SELECT 0 SeqValue
UNION ALL
SELECT 1 SeqValue
UNION ALL
SELECT 2 SeqValue
UNION ALL
SELECT 3 SeqValue
UNION ALL
SELECT 4 SeqValue
UNION ALL
SELECT 5 SeqValue
UNION ALL
SELECT 6 SeqValue
UNION ALL
SELECT 7 SeqValue
UNION ALL
SELECT 8 SeqValue
UNION ALL
SELECT 9 SeqValue
) ONES
CROSS JOIN
(
SELECT 0 SeqValue
UNION ALL
SELECT 10 SeqValue
UNION ALL
SELECT 20 SeqValue
UNION ALL
SELECT 30 SeqValue
UNION ALL
SELECT 40 SeqValue
UNION ALL
SELECT 50 SeqValue
UNION ALL
SELECT 60 SeqValue
UNION ALL
SELECT 70 SeqValue
UNION ALL
SELECT 80 SeqValue
UNION ALL
SELECT 90 SeqValue
) TENS
CROSS JOIN
(
SELECT 0 SeqValue
UNION ALL
SELECT 100 SeqValue
UNION ALL
SELECT 200 SeqValue
UNION ALL
SELECT 300 SeqValue
UNION ALL
SELECT 400 SeqValue
UNION ALL
SELECT 500 SeqValue
UNION ALL
SELECT 600 SeqValue
UNION ALL
SELECT 700 SeqValue
UNION ALL
SELECT 800 SeqValue
UNION ALL
SELECT 900 SeqValue
) HUNDREDS
) SEQ
'웹개발 > Database' 카테고리의 다른 글
[Mysql] 범위검색에 사용하는 Between 연산자 (0) | 2018.08.27 |
---|---|
[Mysql] 현재시간을 기준으로 (+, -) 시간 조회하기 - SUBDATE (0) | 2018.08.14 |
[Mysql] 숫자만 이루어진 값만 조회하는 방법 (0) | 2018.07.04 |
[Mysql] Unable to translate SQLException with Error code '1582' 에러 발생 (0) | 2018.06.19 |
[Mybatis Mssql] 날짜가 원하는 날짜보다 2일 전으로 나타나는 버그 수정 (0) | 2018.05.26 |