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

  • SEARCH
  • Home
  • 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 987841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:32:47+00:00 2026-05-16T05:32:47+00:00

I am having some confusion with a mysql query. Any help appreciated. My current

  • 0

I am having some confusion with a mysql query. Any help appreciated.

My current query:

SELECT
  r.name
, r.network
, i.name
, d.dtime
, d.input
FROM router AS r
INNER JOIN interface AS i
ON r.rid = i.rid
INNER JOIN 1273118400_1_60 AS d
ON i.id = d.id
AND dtime BETWEEN 1273152000 AND 1273153800 WHERE i.status = "active"

Now I am using Unix_Timestamp for the time interval between which I am querying.
Right now I am getting results for :
1273152000, 1273152001, 1273152002 and so on.

I want to get at an interval of 60 seconds, like :
1273152000, 1273152060, 1273152120 and so on.

Any idea how I could go about it????

Please help.
Thank you,

Jillika

  • 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-05-16T05:32:48+00:00Added an answer on May 16, 2026 at 5:32 am

    I’m not sure if it can be simplified further, but you may want to try the following:

    SELECT       r.name,
                 r.network,
                 i.name,
                 d.dtime,
                 d.input
    FROM         router AS r
    INNER JOIN   interface AS i ON (r.rid = i.rid)
    INNER JOIN   (
                     SELECT      t.dtime, dt.input, dt.id
                     FROM        1273118400_1_60 AS t
                     INNER JOIN  (
                                    SELECT dtime, id, input
                                    FROM   1273118400_1_60
                                 ) AS dt ON (dt.dtime = t.dtime AND dt.id = t.id)
                     GROUP BY    t.dtime DIV 60
                 ) AS d ON (i.id = d.id)
    WHERE        (d.dtime BETWEEN 1273152000 AND 1273153800) AND 
                 (i.status = 'active');
    

    Test case:

    CREATE TABLE router (rid int, name varchar(20), network int);
    CREATE TABLE interface (id int, rid int, status varchar(20), name varchar(10));
    CREATE TABLE 1273118400_1_60 (id int, dtime int, input int);
    
    INSERT INTO router VALUES (1, 'router A', 0);
    INSERT INTO interface VALUES (1, 1, 'active', 'interface A');
    INSERT INTO 1273118400_1_60 VALUES (1, 1273151999, 1);
    INSERT INTO 1273118400_1_60 VALUES (1, 1273152000, 2);
    INSERT INTO 1273118400_1_60 VALUES (1, 1273152001, 3);
    INSERT INTO 1273118400_1_60 VALUES (1, 1273152002, 4);
    INSERT INTO 1273118400_1_60 VALUES (1, 1273152059, 5);
    INSERT INTO 1273118400_1_60 VALUES (1, 1273152060, 6);
    INSERT INTO 1273118400_1_60 VALUES (1, 1273152061, 7);
    INSERT INTO 1273118400_1_60 VALUES (1, 1273152062, 8);
    INSERT INTO 1273118400_1_60 VALUES (1, 1273152119, 9);
    INSERT INTO 1273118400_1_60 VALUES (1, 1273152120, 10);
    INSERT INTO 1273118400_1_60 VALUES (1, 1273152121, 11);
    

    Result:

    +----------+---------+-------------+------------+-------+
    | name     | network | name        | dtime      | input |
    +----------+---------+-------------+------------+-------+
    | router A |       0 | interface A | 1273152000 |     2 |
    | router A |       0 | interface A | 1273152060 |     6 |
    | router A |       0 | interface A | 1273152120 |    10 |
    +----------+---------+-------------+------------+-------+
    3 rows in set (0.00 sec)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having some confusion with the new keyword,things work fine when I am
im having some difficulty trying to pull out a specific value from a cookie.
Having some trouble sending properly formatted HTML e-mail from a PHP script. I am
I'm having some confusion if a VOIP App can have multiple tcp sockets monitored
I'm having some real confusion about events in c#... if I have this code
Im having some general confusion with encoding on a little tool I'm writing. First
Having some issues getting my head around the differences between UTF-8, UTF-16, ASCII and
Having some issues with the ... in ObjectiveC. I'm basically wrapping a method and
Having some trouble with what should be a very simple scenario. For example purposes,
Hey having some trouble trying to maintain transparency on a png when i create

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.