sql - MySQL query for rows at specific time intervals -
I appreciate some help from some mysql query is being confused.
Select my current query:
select r.name, r.network, i.name, d.dtime, d.input, router from rr INER iisid = Join the interface as joining the IAD I.rid INNER 1273118400_1_60 as IID = DID And between DTM 1273152000 and 1273153800 Where i.status = "active"
Now I am using Unix_Timestamp for the time interval between which I ask. Right now I am getting results for: 1273152000, 1273152001, 1273152002 and so on.
I have to go for a 60 second interval, such as: 1273152000, 1273152060, 1273152120 and so on.
Any ideas how can I go about it ????
Please help please,
DILICA
Not sure if this can be done further, but you can try the following:
select r.name, r.network, i.name, d.dtime, In the form of RInner Internet interface from d.input routers, I ON (RIDIT = i.rid) INNER JOIN (SELECT t.dtime, dt.input, dt.id to 1273118400_1_60 ATT Inner Join (Select DTEM, ID, Input from 1273118400_1_60) ATDT ON (DT Del Time = T) .dtime and dt.id = t.id) Group TD TiVIV 60) ASD (i.id = d.id) WHERE (between 1273152000 and 1273153800) and (i.status = 'active');
Test case:
Make Table Router (Rated Ent, Name varchar (20), Network Int); Create a tablet interface (id int, missed int, status worker (20), name behavior (10)); Create table 1273118400_1_60 (id int, dtime int, input int); Insert router value (1, 'router a', 0); INSERT (1, 1, 'active', 'interface A') in the interface value; INR 1273118400_1_60 value in INSERT (1, 12731519 99, 1); INR 1273118400_1_60 value in INSERT (1, 1273152000, 2); INR 1273118400_1_60 value in INSERT (1, 1273152001, 3); INR 1273118400_1_60 value in INSERT (1, 1273152002, 4); INR 1273118400_1_60 in INSERT (1, 1273152059, 5); INR 1273118400_1_60 value in INSERT (1, 1273152060, 6); INR 1273118400_1_60 in INSERT (1, 1273152061, 7); INR 1273118400_1_60 in INSERT (1, 1273152062, 8); 1273118400_1_60 values in INSERT (1, 127315211 9, 9); INR 1273118400_1_60 value in INSERT (1, 1273152120, 10); INR 1273118400_1_60 value in INSERT (1, 1273152121, 11);
Result:
+ ---------- + --------- + ----- -------- + ------------ + ------- + | Name | Network | Name | DTM | Input | + ---------- + --------- + ------------- + ------------ + - ------ + | Router a | 0 | Interface A | 1273152000 | 2 | | Router a | 0 | Interface A | 1273152060 | 6 | | Router a | 0 | Interface A | 1273152120 | 10 | + ---------- + --------- + ------------- + ------------ + - ------ + 3 lines set (0.00 seconds)
Comments
Post a Comment