Christian Brosius wrote:
> In my Database, there is a datetime-field and fields for inOctets and outOctets.
> every Second, there is a row added with new values.
>
> I want to create a new table, where the Values are summarized in intervals of a minute
> or a hour with a mysql-query on the orginal table.
Your first task is to create a query that summarizes into intervals. E.g.
SELECT
DATE_FORMAT(ts, '%Y-%m-%d %h:%i') AS I
SUM(inOctects),
SUM(outOctects),
FROM foo
GROUP BY I;
Using the INSERT INTO ... SELECT ... syntax, you can then insert these summary records in another table (see
http://dev.mysql.com/doc/mysql/en/insert.html)
--
felix
Please use
BBCode to format your messages in this forum.