SELECT 
    DATE(t.transaction_date) as sale_date,
    COUNT(t.id) as total_orders,
    AVG(TIMESTAMPDIFF(MINUTE, t.created_at, t.updated_at)) as avg_processing_time_minutes
FROM transactions t
WHERE t.type = "sell" 
AND t.status = "final"
AND t.created_at >= DATE_SUB(CURRENT_DATE, INTERVAL 30 DAY)
GROUP BY DATE(t.transaction_date)
ORDER BY sale_date;