convert serial to date and query SQL
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi, I'm trying to convert the first column of a T_Name (T_Name = fetch(conn,{'MSFT'},'2012-01-01','2012-04-01');) into date. The format I get is the yahoo serial number. I've tried with datestr but it doesn't work when I try to do the whole column.
Another question. I have a database with two table. One table has the tickers and the ID number and the other has the id number and the prices. How can do to get the ID number corresponding to a given the ticker from table 1? . I use SQL server.
Thanks so much. Alberto
Note: What I'm trying to do is simply get the historic prices from yahoo and store them into a SQL table but with date format not serial.
1 Commento
Tushar Upadhyay
il 1 Mag 2017
As you mentioned that you tried datestr but it does not work when you tried to do the whole column, I am assuming that datestr is working for you for one single data. It would be difficult for me to answer this without having sample column data. However, I believe that below link might help you to achieve that:
https://www.mathworks.com/matlabcentral/newsreader/view_thread/284903
For your second question, I assume that you want to get the ID number corresponding to a given ticker from table 1 and also the price associated with it from the Table 2.
In that case, please create a sql statement having join and execute in the MATLAB
Sqlquery = ‘SELECT B.id, A.ticker, B.price FROM A INNER JOIN B ON A.id = B.id WHERE A.ticker = ‘<>’ ‘; After that please execute the query using MATLAB. For more information on how to execute the sql query through MATLAB, follow the below documentation:
https://www.mathworks.com/help/database/ug/exec.html
Risposte (0)
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!