views:

33

answers:

2

Hi, my query is as follows:

SELECT
r.name
  , r.network
  , r.namestring
  , i.name
  , r.rid
  , i.id
  , d.dtime
  , d.ifInOctets
FROM router AS r
INNER JOIN interface AS i
ON r.rid = i.rid
INNER JOIN 1278993600_1_60 AS d
ON i.id = d.id
AND dtime BETWEEN 1279027200 AND 1279029000
WHERE r.network = "ITPN"
AND i.status = "active"
WHERE i.id BETWEEN 1418 AND 1518

There is the problem when I add the last part WHERE i.id BETWEEN 1418 AND 1518 how I could add extra condition here? Any help??? Thank you

A: 
SELECT r.name, r.network, r.namestring, i.name, r.rid, i.id, d.dtime,
       d.ifInOctets
FROM router AS r
INNER JOIN interface AS i
ON r.rid = i.rid
INNER JOIN 1278993600_1_60 AS d
ON i.id = d.id
AND d.dtime BETWEEN 1279027200 AND 1279029000
WHERE r.network = "ITPN"
AND i.status = "active"
AND i.id BETWEEN 1418 AND 1518
Michael Pakhantsov
I tried that. goes into some kind of infinite loop and the query never stops
jillika iyer
@jillika iyer, We need table structures for providing answer, may you update question and add definition for tables: routes, interface and 1278993600_1_60
Michael Pakhantsov
@jillika iyer: sure you don't have any typos in your query? It should be working
nico
SQL statement like that can't go into infinate loops. How many records are in each table?
Ash Burlaczenko
thanks a lot.worked.i was querying through some 100000 data set. so it was crashing :P
jillika iyer
+1  A: 

You have two WHERE clauses, and only one is allowed. See Michael's answer for the correct syntax.

RedFilter