Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8572009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:54:33+00:00 2026-06-11T18:54:33+00:00

Is it possible to write a SELECT query to retrieve data with a 60

  • 0

Is it possible to write a SELECT query to retrieve data with a 60 seconds timestamp interval?

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:

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)

And I need to get the data with grouping the results with a 60 secs interval and adding the IN_BYTES and OUT_BYTES…

Is it possible to perform this or do I have to write some code in PHP?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:54:34+00:00Added an answer on June 11, 2026 at 6:54 pm

    If your timestamp is stored in LAST_SWITCHED, it looks like a Unix timestamp. That’s the number of seconds since 1970. If that’s true, you can group by minute by dividing the Unix timestamp by 60:

    select  LAST_SWITCHED div 60 as StartOfMinuteInterval
    ,       sum(IN_BYTES) as SumIn
    ,       sum(OUT_BYTES) as SumOut
    group by
            LAST_SWITCHED div 60
    

    In MySQL, div is an integer divide. So x div y is equal to round(x / y).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's assume i have a query SELECT val FROM tbl I want to write
Is it possible to write this query in codeigniter active records? $Main_Nav_Query = mysql_query(SELECT
I have two tables table1 and table2, i need to write a select query
Is it possible to write a query just like this? SELECT a FROM Action
It is possible to write a query get all that record from a table
Is it possible to write JPQL query like following: select count(*) > 0 from
Is it possible to write a cross server select query using MySQL Client. Basically
i have this table in database which called data and i want make this
I would like to know if its possible to write a nested select statment?
Is it possible to write a HQL query that groups results by the discriminator

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.