I'm trying to build a query that excludes specific rows by their ID, but I can't get it to work. Right now, I have:
AND (id <> '4151')
Which I've tried with and without the single quotes. And in addition to which, I tried:
AND (id != '4151')
Also, I've tried:
AND (id NOT IN (4151))
And that didn't work either.
Eventually, I'll need to be able to exclude several rows at a time.
Yes, the core query works just fine.
Yes, the ID column exists.
Yes, the record also exists.
When using the above examples do you get errors or are the id's simply not excluded?
Hi! No, I don't get any errors; the row simply isn't excluded.
Just tried your third option and it is working for me I only left the outside brackets out:
NOT IN ( 13, 15 )
Which got me thinking about the brackets — I'd not placed earlier parts of the query in their own parentheses.
I freely admit that databases aren't my strong point.
All sorted now, guys.
Thanks for your help!
Which is why you should post the entire query
Glad you got your problem sorted out.
Good you have it sorted indeed! Have a happy new year