2
是否可以使用60秒時間戳間隔編寫SELECT查詢來檢索數據?按時間戳選擇組SQL按1分鐘間隔
我想獲取數據來製作圖表,並且我已將數據轉儲到MySQL數據庫中。我有一個時間戳,目的端口的流量和字節sended:
mysql> 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)
我需要用一個60秒的時間間隔分組的結果,並添加IN_BYTES和OUT_BYTES獲取數據...
是否有可能執行此操作,還是必須在PHP中編寫一些代碼?
不錯!我會嘗試。非常感謝你。 –