• There seems to be a mistake on the table

    Listing 5.4: The "Activity totals by date" query

    Because option 2 seems more efficient on IO as it sends this results.

    CREATE NONCLUSTERED INDEX FK_ProductID_ModifiedDate

    ON SalesOrderDetail_index (ProductID, ModifiedDate)

    SELECT ModifiedDate ,

    ProductID ,

    SUM(OrderQty) 'No of Items' ,

    AVG(UnitPrice) 'Avg Price' ,

    SUM(LineTotal) 'Total Value'

    FROM SalesOrderDetail_index

    WHERE ModifiedDate = '2003-10-01'

    GROUP BY ModifiedDate ,

    ProductID ;

    Tabla 'SalesOrderDetail_index'. Recuento de exámenes 1, lecturas lógicas 384

    Tiempo de CPU = 0 ms, tiempo transcurrido = 7 ms.