[프로그래머스 / SQL] 오프라인/온라인 판매 데이터 통합하기
-CodeSELECT DATE_FORMAT(SALES_DATE, '%Y-%m-%d') AS SALES_DATE, PRODUCT_ID, USER_ID, SALES_AMOUNTFROM ONLINE_SALEWHERE SALES_DATE LIKE '2022-03%'UNIONSELECT DATE_FORMAT(SALES_DATE, '%Y-%m-%d') AS SALES_DATE, PRODUCT_ID, NULL AS USER_ID, SALES_AMOUNTFROM OFFLINE_SALEWHERE SALES_DATE LIKE '2022-03%'ORDER BY SALES_DATE, PRODUCT_ID, USER_ID;테이블이 2개라 JOIN을 통해서 조회..
2025. 8. 4.