What the best way to calculate interval averages for a tag via OLEDB?

Discussion created by dadachi on Sep 7, 2011
Latest reply on Sep 9, 2011 by dadachi

I need to calculate the average values for a tag over minutes interval (between 1 and 2441) over a date range. 
For instance, I may be asked to calculate the 1 minute average value for tag name "Cusman21" over the past 3 days. 

I'm wondering what is the best way to accomplish this - do I query the piarchive..piavg table?  Or should I just
craft a SQL query against the piarchive.picomp table?

I have searched through the forums and not found any posts that might help.  I have seen a few references to queries
against the piavg table, but nobody here has ever queried the piavg table before and I haven't found documents
describing best practices querying data from piavg.

any help would be greatly appreciated.