with a as(
select item_id,sum(sales_num) s1,sum(sales_price) s2
from sales_tb
group by item_id)
select style_id,round(sum(s1)/sum(inventory-s1)*100,2) as 'pin_rate(%)',
round(sum(s2)/sum(tag_price*(inventory))*100,2) as 'sale-through_rate(%)'
from product_tb pt left join a on pt.item_id=a.item_id
group by style_id
order by style_id