selecting only the first few
rows.
> -Original Message-
> From: Hal?sz S?ndor [mailto:h...@tbbs.net]
> Sent: Monday, July 16, 2012 8:25 PM
> To: mysql@lists.mysql.com
> Subject: RE: Trouble with Average
>
> >>>> 2012/07/16 14:25 -0700, Rick James >&g
2012/07/16 14:25 -0700, Rick James
Here's a different way to "smooth" numbers. It uses an exponential moving
average instead of "the last 5".
SELECT Time,
@a := (9 * @a + Value) / 10 AS moving_avg
FROM tbl
JOIN ( SELECT @a := 0 ) AS x;
Notes:
* Make 10 larger or smaller, depe
th you want it.
* 9=10-1
* @a := 0 should be changed to some reasonable starting value, else the graph
will be artificially low to start with.
> -Original Message-
> From: Hal?sz S?ndor [mailto:h...@tbbs.net]
> Sent: Monday, July 09, 2012 7:48 PM
> To: mysql@lists.mysql.co
2012/07/07 12:10 -0600, Albert Padley
I have a log file that captures data from various sensors every minute that
we use to draws graphs on our website.
The table looks like this:
CREATE TABLE `log` (
`id` int(14) NOT NULL auto_increment,
`VarName` varchar(255) NOT NULL,
`TimeStri
I have a log file that captures data from various sensors every minute that
we use to draws graphs on our website.
The table looks like this:
CREATE TABLE `log` (
`id` int(14) NOT NULL auto_increment,
`VarName` varchar(255) NOT NULL,
`TimeString` datetime NOT NULL,
`VarValue` decimal(25,6