https://school.programmers.co.kr/learn/courses/30/lessons/131537
(SELECT DATE_FORMAT(SALES_DATE, "%Y-%m-%d") as SALES_DATE, PRODUCT_ID, USER_ID, SALES_AMOUNT
FROM ONLINE_SALE AS N
WHERE SALES_DATE LIKE '2022-03%'
UNION
SELECT DATE_FORMAT(SALES_DATE, "%Y-%m-%d") as SALES_DATE, PRODUCT_ID, NULL AS USER_ID, SALES_AMOUNT
FROM OFFLINE_SALE AS F
WHERE SALES_DATE LIKE '2022-03%')
ORDER BY SALES_DATE, PRODUCT_ID, USER_ID
'코딩테스트(Coding Test) > 프로그래머스' 카테고리의 다른 글
[프로그래머스] 인사고과 (2) | 2024.05.01 |
---|---|
[프로그래머스] 괄호 회전하기 (1) | 2024.02.10 |
[프로그래머스.SQL] GROUP BY (0) | 2023.11.24 |
[프로그래머스.SQL] SUM, MAX, MIN (0) | 2023.11.24 |