Posted by Bruno Panetta on 10/21/76 11:31
Hi, I have a table like the following fields:
TradeDate Item Price
Now, suppose I want to do an update like this: every price
corresponding to a date higher than '30 Sep 2005' will be reset to the
latest price in that item. Can I do something like the following
UPDATE Table t SET Price = (SELECT TOP 1 Price FROM Table q WHERE
q.Item = t.Item ORDER BY TradeDate DESC) WHERE t.TradeDate > '30 Sep
2005'
or is there a better way?
Thank you very much.
Bruno
[Back to original message]
|