These temperatures are taken from Firebird every day every 5 minutes. How can we derive the daily value for each day from the data in the table for another day? I do not understand just how to select and calculate the individual values also to derive.
1 answer
In the request, you need to group the records by date (excluding time) and use the AVG()
aggregate function. In MySQL, it would look something like this:
SELECT DATE(tablename.datetime), AVG(tablename.value) FROM tablename GROUP BY 1
- Not exactly what I need at the output of the table, with the average daily value, where the horizontal number from 1 to 31 and the vertical month from 1 to 12, the total is a table for a year. Generally about this type - rghost.ru/32318341/image.png Although it can somehow make a procedure on the basis of which calculates the average daily? but I don't know how - zerpico
- The request returns the prepared information with an average daily value for each day, and the output in an appropriate form must be done on the side of the application. You walk through the data source from beginning to end and scatter information across the cells of a StringGrid. - KiTE
- Yeah well, I understand, thanks. and the last question since it is not so new. How to display the same from the first day of the selected month to the first day of the next month. Well, that is SELECT WEATHER.DATE, AVG (WEATHER.TEMP) FROM WEATHER WHERE WEATHER.DATE> = (01/01/2011) and WEATHER.DATE <(01/02/2011 GROUP BY 1 for example, well, I mean from the selected month to the next . - zerpico
|