I have 2 tables:
1) table Masterdates which contains all dates since Jan 1, 1900
2) table Stockdata which contains stock data in the form date, symbol, open, high, low, close, volume (primary key = date, symbol)
This is what I'm looking to retrieve (presented here in CSV format)
MDate,SDate,Symbol,Open,High,...
6/4/2001,6/4/2001,Foo,47,49,...
6/5/2001,null,null,null,null,...
6/6/2001,6/6/2001,Foo,54,56,...
where MDate is from Masterdates and SDate is from Stockdata. I need to have the output start with the first (earliest) extent date for the desired symbol (in this example, Foo, starting on 6/4/2001) in Stockdata, and then include all dates in Masterdates up to and including the last (latest) available date for the desired symbol in Stockdata, outputting nulls where there is no corresponding Stockdata record for a given Masterdate record in the range described.
Is there a way to do this in a single query, a series of queries, and/or by adding auxiliary tables, that will yield fast results? Or will I have to dump out supersets of what I want, and then construct the final output using my (non-SQL) programing language?
TIA