title: Group SQL select by timestamp 1 minute interval
body: <p>Is it possible to write a SELECT query to retrieve data with a 60 seconds timestamp interval?</p>
  
  <p>I want to get data to make a chart, and I have the data dumped on a MySQL database. I have the flows with the timestamp, the destination port and the bytes sended:</p>
  
  <pre><code>mysql&gt; select * from eth2_flows limit 1;
  +---------+----------+---------+-------+----------+-----------+-------------+---------------+-------------+---------------+---------------+----------------+-----------+----------+-----------+----------+---------------------+----------------------+----------------------+-------------------+-----------------------+------------------------+-----------------+------------------+----------+---------------+---------------+----------+---------------+---------+-----------+
  | idx     | IN_BYTES | IN_PKTS | FLOWS | PROTOCOL | TCP_FLAGS | L4_SRC_PORT | IPV4_SRC_ADDR | L4_DST_PORT | IPV4_DST_ADDR | LAST_SWITCHED | FIRST_SWITCHED | OUT_BYTES | OUT_PKTS | ICMP_TYPE | SRC_VLAN | IP_PROTOCOL_VERSION | CLIENT_NW_DELAY_USEC | SERVER_NW_DELAY_USEC | APPL_LATENCY_USEC | RETRANSMITTED_IN_PKTS | RETRANSMITTED_OUT_PKTS | OOORDER_IN_PKTS | OOORDER_OUT_PKTS | L7_PROTO | IPV6_SRC_ADDR | IPV6_DST_ADDR | HTTP_URL | HTTP_RET_CODE | HTTP_UA | HTTP_MIME |
  +---------+----------+---------+-------+----------+-----------+-------------+---------------+-------------+---------------+---------------+----------------+-----------+----------+-----------+----------+---------------------+----------------------+----------------------+-------------------+-----------------------+------------------------+-----------------+------------------+----------+---------------+---------------+----------+---------------+---------+-----------+
  | 1265340 |       40 |       1 |     0 |        6 |        16 |        4805 |    2886729835 |         139 |    2886729734 |    1344280441 |     1344280441 |        40 |        1 |         0 |        0 |                   4 |                    0 |                    0 |                 0 |                     0 |                      0 |               0 |                0 |        0 |               |               |          |             0 |         |           |
  +---------+----------+---------+-------+----------+-----------+-------------+---------------+-------------+---------------+---------------+----------------+-----------+----------+-----------+----------+---------------------+----------------------+----------------------+-------------------+-----------------------+------------------------+-----------------+------------------+----------+---------------+---------------+----------+---------------+---------+-----------+
  1 row in set (0.00 sec)
  </code></pre>
  
  <p>And I need to get the data with grouping the results with a 60 secs interval and adding the IN_BYTES and OUT_BYTES...</p>
  
  <p>Is it possible to perform this or do I have to write some code in PHP?</p>