SELECT p.name,SUM(tsl.quantity)/COUNT(DISTINCT DATE(t.transaction_date)) daily_velocity FROM products p JOIN transaction_sell_lines tsl ON p.id=tsl.product_id JOIN transactions t ON tsl.transaction_id=t.id WHERE t.type="sell" AND tsl.line_discount_amount>0 GROUP BY p.id,p.name ORDER BY daily_velocity DESC;