I have a table of historical stock prices for each stock trading on the S&P500
index.
Each business day, 500 new records are inserted into the historical_prices
table:
symbol, close_date, close_price.
The process frequently fails for numerous reasons, only a fraction of the records where added.
Thursday ran correctly (500 new records), Friday failed (adding only 400 records).
I need to identify the remaining 100 records that were not added, to rerun and complete the process.
Would a nested query be the most efficient way? Select the 500 records from Thursday, and measure against the 400 records from Friday)
SELECT * FROM historical_prices
WHERE `close_date` = '2016-01-16'
RIGHT JOIN (
SELECT * FROM historical_prices
WHERE `close_date` = '2016-01-15')
WHERE `symbol` IS NULL;
Thanks in advanced!