• Sorry, looks like the code didn't paste correctly the first time - it read the 'less than' and 'greater than' as HTML brackets. Should be:

    UPDATE Test_HistoricalData a

    SET Avg1WkVol=(SELECT AVG(b.Volume)

    FROM Test_HistoricalData b

    WHERE b.SymbolID = a.SymbolID AND b.MarketDate < a.MarketDate AND b.MarketDate > a.MarketDate-8)

    WHERE

    a.SymbolID=113

    GO