JJunior
JJunior

Reputation: 2849

mysql query doubt

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

Upvotes: 0

Views: 91

Answers (2)

Michael Pakhantsov
Michael Pakhantsov

Reputation: 25390

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

Upvotes: 0

D'Arcy Rittich
D'Arcy Rittich

Reputation: 171491

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

Upvotes: 1

Related Questions