How to make sql query the average value of a tag in the last hour

A have historical tag with address [default]TESTSTARTSTOP/Hours/Active power .How to make sql query the average value of this tag in the last hour?

Hi,

How would you like to query your tag (with a property binding ? in a chart ? in a table ?)

One thing for sure is that you can do this using script.
I would suggest you to check out this part of the user manual :
https://docs.inductiveautomation.com/display/DOC80/system.tag.queryTagHistory

Why not using a transaction group to store your tag ?
This way you can have control on the table name, the column where your tag will be stored and it will be easier to use complex SQL queries .

1 Like

I think the queryTagCalculations function would be more appropriate:
https://docs.inductiveautomation.com/display/DOC80/system.tag.queryTagCalculations