This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

SQL query using Trend data?
#1
Hi!

Is there a way to use SQL to fetch rows/calculate aggregate values for the trend data?

The table "Trends" seems to contain metadata (name, id...) about the trends, not the actual data (?).

I would like to answer questions like "What was the average temperature last month?" or "How much water was used this day last year?".

Sincerely Robert
Reply
#2
See this: https://openrb.com/docs/trends-new.htm
Reply
#3
I looked at that earlier but couldn't figure out how to use aggregate functions like "GROUP BY ..." or "AVG(...)".

I'm would like to make the database do the math for me, for example to determine the average value of a column in a given time span rather than having to traverse hundreds of rows manually in a script and summing up and dividing. I think the database will make it faster and more robust than anything I can think up :-)
Reply
#4
All calculations have to be done in the script using Lua. There's no option to use SQL as trends data is stored in a different format.
Reply


Forum Jump: