select
store_id,
store_name,
product_category,
sum(inventory_quantity) inventory_quantity,
sum(sales_amount) sales_amount
from
sales_inventory s1
left join
products s2
using(product_id)
left join
stores s3
using(store_id)
group by 1,2,product_id,3
having sum(inventory_quantity)<10 and sum(sales_amount)>5000
order by 1, product_id
真是一道憨包题目,出题人是中专生吧,实际会有这种需求嘛



京公网安备 11010502036488号