I have an ms access database with table DATA as follows
DATE | SYMBOL | CLOSE |
01/01/99 ABC 10.00
01/02/99 ABC 13.00
01/07/99 ABC 20.00
01/12/99 ABC 22.00
01/30/99 ABC 39.00
01/01/99 XYZ 11.00
01/02/99 XYZ 14.00
01/07/99 XYZ 17.00
01/12/99 XYZ 19.00
01/30/99 XYZ 21.20
And using matlab I would like to select all close values for which their corresponding dates match my 'dates of interest' for a given symbol, so I use an query as follows:
sqlquery = ['select CLOSE from DATA where DATE in (' dates ') and SYMBOL = 'ABC'];
where
dates = '#01/01/99#,#01/02/99#,#01/03/99#,#01/04/99#,#01/05/99#,#01/06/99#,#01/07/99#';
The issue I am facing is such that if I am asking for a CLOSE value corresponding to a query date which does not exist as a record for the given symbol, I would like to receive a null value for CLOSE where a record is missing (the current query does not do this). Ultimately in my program I would like to take the response from my query and copy it into an array for the symbol as follows:
01/01/99 | 10.00 |
01/02/99 | 13.00 |
01/03/99 | NaN |
01/04/99 | NaN |
01/05/99 | NaN |
01/06/99 | NaN |
01/07/99 | 20.00 |
Is there a way to accomplish this response data via an sql query?