mysql查询疑问

时间:2010-08-11 15:17:44

标签: mysql database

我的查询如下:

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

添加最后一部分WHERE i.id BETWEEN 1418 AND 1518时出现问题  我怎么能在这里添加额外的条件? 任何帮助??? 谢谢

2 个答案:

答案 0 :(得分:1)

您有两个WHERE子句,只允许一个。请参阅迈克尔的答案,了解正确的语法。

答案 1 :(得分:0)

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