How to use IN & NOT IN same query [closed]

You must specify column for NOT IN

SELECT * FROM users WHERE username IN ('...') AND username NOT IN ('aniket27') ORDER BY id DESC LIMIT 2

But first condition will be sufficient to match elements that are listed in NOT IN part, just remove them from first IN list.

Browse More Popular Posts

Leave a Comment