SELECT 
    HOUR(t.transaction_date) as hour_of_day,
    DAYNAME(t.transaction_date) as day_of_week,
    COUNT(*) as transaction_count,
    SUM(t.final_total) as total_sales
FROM transactions t
WHERE t.type = "sell" 
AND t.status = "final"
AND t.transaction_date >= DATE_SUB(CURRENT_DATE, INTERVAL 30 DAY)
GROUP BY HOUR(t.transaction_date), DAYNAME(t.transaction_date)
ORDER BY day_of_week, hour_of_day;