SELECT 
    e.asset_id,
    SUM(e.downtime_hours * e.prod_rate + e.parts_cost + e.labor_cost +
        e.env_cost + e.reg_cost + e.safety_cost) AS total_cost,
    COUNT(*) AS events
FROM events e
GROUP BY e.asset_id
ORDER BY total_cost DESC;