25 - 销售分析III
sql
-- where 是分组之前筛选数据
-- having 是分组之后筛选数据
select
p.product_id,p.product_name
from
Sales s left join Product p on s.product_id=p.product_id
group by
product_id
having
min(sale_date) >="2019-01-01" and max(sale_date)<="2019-03-31";