Reputation: 43
I have these two queries working:
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")
I am attempting to combine them into one query:
var finalQuery = client.query("SELECT * FROM tableone WHERE time = 1 AND
WHERE (tableone.id) NOT IN ( SELECT tabletwo.id FROM tabletwo)");
However, I am running into this error: syntax error at or near "WHERE"
How can I correctly, combine the two queries?
Upvotes: 2
Views: 1161
Reputation: 12953
drop the second WHERE
, it's not needed:
var finalQuery = client.query("SELECT * FROM tableone WHERE time = 1 AND
(tableone.id) NOT IN ( SELECT tabletwo.id FROM tabletwo)");
Upvotes: 4