SQL 고득점 Kit - SELECT Level4 - 오프라인/온라인 판매 데이터 통합하기

Purple·2022년 10월 22일

sql

목록 보기
18/22

https://school.programmers.co.kr/learn/challenges?page=1&languages=mysql&order=recent

select date_format(sales_date, '%Y-%m-%d') as sales_date, product_id, user_id, sales_amount
from online_sale
where sales_date >= '2022-03-01' and sales_date < '2022-04-01'

union all

select date_format(sales_date, '%Y-%m-%d') as sales_date, product_id, NULL as user_id, sales_amount
from offline_sale
where sales_date >= '2022-03-01' and sales_date < '2022-04-01'

order by sales_date, product_id, user_id

union all

where <DATE 컬럼> >/>=/>=/< '2022-01-01'

profile
안녕하세요.

0개의 댓글