select round(sum(a.sales_price)/sum(b.tag_price*a.sales_num)*100,2) `discount_rate(%)`
from sales_tb a
left join product_tb b
on a.item_id = b.item_id
select round(sum(a.sales_price)/sum(b.tag_price*a.sales_num)*100,2) `discount_rate(%)`
from sales_tb a
left join product_tb b
on a.item_id = b.item_id