calculate the average of a column then move it to excel

A

Aster99

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
 
O

onedaywhen

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top