calculate the average of a column then move it to excel
I have the following results after a sql query:
off_time mydata2 -------- -------- 12:15 4.324 12:30 5.26 12:45 6.9654 using this sql statement: select off_time, least(2+(0.044117*CT_OFF_GEN),8) as mydata2 from b_NRatio Using the above sql how can I average the the mydata2 column and store it in a variable? I then need to copy it to Excel like so: ADO_rs.Open ActiveCell.Offset(x, 5).Value = ADO_rs.Fields!AVGOFmydata2 David |
calculate the average of a column then move it to excel
This isn't standard SQL, but the AVG function is, so a guess:
select AVG(least(2+(0.044117*CT_OFF_GEN),8)) as AVGOFmydata2 from b_NRatio -- "Aster99" wrote in message ... I have the following results after a sql query: off_time mydata2 -------- -------- 12:15 4.324 12:30 5.26 12:45 6.9654 using this sql statement: select off_time, least(2+(0.044117*CT_OFF_GEN),8) as mydata2 from b_NRatio Using the above sql how can I average the the mydata2 column and store it in a variable? I then need to copy it to Excel like so: ADO_rs.Open ActiveCell.Offset(x, 5).Value = ADO_rs.Fields!AVGOFmydata2 David |
All times are GMT +1. The time now is 06:27 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com