我有两个查询工作:
var queryOne = client.query("SELECT * FROM tableone WHERE (tableone.id) NOT
IN ( SELECT tabletwo.id FROM tabletwo)");
var queryTwo = client.query("SELECT * FROM tableone WHERE time = 1")
我正在尝试将它们合并为一个查询:
var finalQuery = client.query("SELECT * FROM tableone WHERE time = 1 AND
WHERE (tableone.id) NOT IN ( SELECT tabletwo.id FROM tabletwo)");
但是,我遇到了这个错误:语法错误在或附近" WHERE"
我怎样才能正确地结合这两个查询?
答案 0 :(得分:3)
删除第二个WHERE
,不需要它:
var finalQuery = client.query("SELECT * FROM tableone WHERE time = 1 AND
(tableone.id) NOT IN ( SELECT tabletwo.id FROM tabletwo)");