• Or maybe this?:

    SELECT

    t.ProductID

    ,t.Order_Day

    ,t.Order_Quantity

    FROM (

    SELECT

    ProductID

    ,Order_Day

    ,Order_Quantity

    ,ROW_NUMBER() OVER(PARTITION BY ProductID ORDER BY Order_Quantity DESC) AS row_num

    FROM (

    SELECT

    SUM(OrderQuantity) AS Order_Quantity

    ,ProductID

    ,DATEADD(DAY, DATEDIFF(DAY, 0, OrderDate), 0) AS Order_Day

    FROM Transactions

    GROUP BY ProductID, DATEADD(DAY, DATEDIFF(DAY, 0, OrderDate), 0)

    ) AS daily_totals

    ) AS t

    WHERE t.row_num = 1

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.