I have a query that returns raw tick data from a table. Unfortunately after
even a few days there are hundreds of thousands of rows so the following
query is not efficient.
SELECT * FROM RAWTICKDATA WHERE Status = 'I' AND ContractCode = ? AND
RawTickID = (SELECT Max(RawTickID) FROM RAWTICKDATA WHERE Status = 'I' AND
ContractCode = ? AND PRICE =(SELECT Min(Price) FROM RAWTICKDATA WHERE Status
= 'I' AND ContractCode = ?))
The most obvious solution then is to get all tick data with status ='I'
(Imported) for a contract, process it and then move it to another table for
archiving. I am faced with a problem however: After selecting all data for a
contract with status='I' the application was updating these records to a new
status of 'P' (processed). Unfortunately another application is continuning
to feed in live data and so it is possible that we will inadvertantly update
unprocessed data to 'P'.
Question: Is it possible to select all records with status 'I' (from above
query) and update their status to 'P' in one sequence?
I am not a programmer, but if this is possible I should be able to implement
the query.
Many thanks.
Steve