Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
lampis
Starting Member
10 Posts |
Posted - 2011-10-04 : 04:07:20
|
| Hello,In my database I have stored values as price levels of certain assets. The table consists of Date, Market, Asset and Value. There are a number of markets and each market have different assets. I want to be able to pick data from a particular market and import it to excel.I want the data as returns instead of price levels, i.e. I want to divide the price level at time t with the price level at time t-1 Value_t/Value_(t-1) as my values in Excel. Also, I want the name of the asset in my excel sheet.Could you help me with writing the SQL query (in VBA) for doing this import?As of now I have this:"sql_q = "SELECT [Date],[Value] FROM [Prices] WHERE [Market] = 'Market' AND [Date] >= 'Date' ORDER BY [Date]""This picks out the market "Market" from the date "Date", but now I get all values as price levels and all values in only one column. I want them as returns and in one column for each asset.Thanks in advance./lampis |
|
|
|
|
|