Artem Layko
Artem Layko

Reputation: 78

Two "not in" in one query?

i have this sql query

SELECT * FROM bots WHERE id NOT IN (select botid from messages where messages.recipient = :recipient) AND NOT IN (:bots) AND messages_today < 50 limit 1

And when i'm executing, it returns error. How to make this with two "not in"s and without errors?

Upvotes: 0

Views: 45

Answers (1)

Uueerdo
Uueerdo

Reputation: 15961

Those are separate conditions, more like >= and <=, not like BETWEEN x AND y. There is no "left hand argument" to the second NOT IN.

Change AND NOT IN to AND id NOT IN

Upvotes: 2

Related Questions