• In trying to combine the two subqueries into one, I got this far, but have encountered the error messages:

    The multi-part identifier "a.IDNumber" could not be bound.

    The multi-part identifier "a.MarketDate" could not be bound.

    UPDATE a

    SET StDev_OH_30Day=T.StDev_OHdiff

    , StDev_OL_30Day=T.StDev_OLdiff

    FROM myTable,

    (SELECT STDEV(b.OHdiff) AS StDev_OHdiff

    , STDEV(b.OLdiff) AS StDev_OLdiff

    FROM myTable b

    WHERE b.IDNumber = a.IDNumber

    AND b.MarketDate < a.MarketDate

    AND b.MarketDate > a.MarketDate-31 ) AS T

    WHERE

    a.MarketDate BETWEEN @lastUpdate+.1 AND @updateThrough

    AND a.IDNumber BETWEEN @minIDNumber AND @maxIDNumber

    If anyone's got any ideas or suggestions, I would really appreciate it.

    Thanks!