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 |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-07-14 : 08:51:51
|
Björn writes "Hello,i have a rather big problem, but i think there exists a rather simple solution to it. I want to import set of numbers into excel. these sets consist of 3 things. 1) an id number2)a date 3) a value (price)now i would like to import various kind of these id numbers simultanously but only where there is a price for all of them for a certain date. e.gid1 begins in the year 2000id2 begins in the year 2001id3 begins in the year 2001and id4 begins in the year 2004now i do not know previously when each one starts i just know when the earliest and the latest id starts so i would like to write something like the following:---------------------------------------------------------------Sql = "SELECT ts_histdata_isin, ts_histdata_date, ts_histdata_close FROM histdata WHERE ts_histdata_isin IN ('" For i = 0 To UBound(isin) Sql = Sql + CStr(isin(i)) + "','" Next i Sql = Left(Sql, Len(Sql) - 2) + ")" Sql = Sql + " AND ts_histdata_date IN ('" For i = 0 To UBound(datearray) Sql = Sql + CStr(datearray(i)) + "','" Next i Sql = Left(Sql, Len(Sql) - 2) + ")" Sql = Sql + " ORDER BY ts_histdata_date ASC, ts_histdata_isin ASC group by ts_histdata_date"---------------------------------------------------------------but here i getid1 date price1 for the dates between 2000 and 2001then it follows in the excel sheet withid1 date price1id2 date price2 id3 date price3 between the years 2001 and 2004 and finally i get what i only want to haveid1 date price1id2 date price2id3 date price3id4 date price4 for the year 2005 till today (or the last date)is there a different solution to this? i have tried everything but do not get it to workany answer would be very appreciatedthank you Björn" |
|
|
|
|