SELECT HOUR(t.transaction_date) hour,COUNT(DISTINCT t.contact_id) visitors,COUNT(DISTINCT CASE WHEN t.type="sell" THEN t.id END) sales,COUNT(DISTINCT CASE WHEN t.type="sell" THEN t.id END)*100.0/COUNT(DISTINCT t.contact_id) conversion_rate FROM transactions t GROUP BY HOUR(t.transaction_date) ORDER BY conversion_rate DESC;