Reputation: 581
Right now, I'm using the BETWEEN condition to gather up account numbers, but the only account numbers I want to grab are:
2999, 3000 to 3004, and 3006 - 3010 (basically skipping 3005)
How would I format the BETWEEN?
Upvotes: 0
Views: 1962
Reputation: 175596
You can use NOT IN
to exclude values from range:
SELECT *
FROM your_table
WHERE col BETWEEN 2999 AND 3010
AND col NOT IN (3005) -- values you want to exclude
Upvotes: 12