SQL query using Trend data? - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: SQL query using Trend data? (/showthread.php?tid=4364) |
SQL query using Trend data? - temp4 - 09.11.2022 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 RE: SQL query using Trend data? - admin - 09.11.2022 See this: https://openrb.com/docs/trends-new.htm RE: SQL query using Trend data? - temp4 - 10.11.2022 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 :-) RE: SQL query using Trend data? - admin - 10.11.2022 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. |