Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
sql in excel
#5
I tried a code like this:

Macro Macro5
Code:
Copy      Help
str start_date("01/05/11") end_date("31/12/11") temp_date

temp_date=start_date

ExcelSheet es.Init("" 8|16)
Database db2.Open(db2.CsExcel(artemp))
ARRAY(str) a1
DATE d=start_date
int row=1
for r 0 a.len
,rep
,,q1.format("SELECT SUM(b) FROM [test$] WHERE DateValue(c)=#%s# AND a='%s'" temp_date a[r])
,,db2.QueryArr(q1 a1 1)
,,str x=a1
,,es.SetCell(x 1+r row)
,,d=d+1
,,temp_date=d
,,if(temp_date=end_date)
,,,row+1
,,,break

but many querys and takes time.

Is possible to use something like this: http://stackoverflow.com/questions/3946 ... en-2-dates to speed up the code?


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)