SELECT industry, round(sum(sale_amount), 2) total_sales_amount FROM ( SELECT DISTINCT b.industry, a.sale_amount FROM sales_underline AS a JOIN merchants_underline AS b ON a.merchant_id = b.merchant_id ) AS a GROUP BY industry ORDER BY total_sales_amount DESC, industry ASC
此题ez,依旧是先表连结然后GROUP BY 就好了