Skip to content
Advertisement

The inverse of a between select

I want to select the inverse of a data range in a Postgres database: the query i am trying to use is

SELECT * 
FROM projects 
WHERE lastactivity BETWEEN 2015-08-3 AND 2015-09-11

Advertisement

Answer

Use NOT operator in your BETWEEN condition like

SELECT * 
FROM projects 
WHERE lastactivity NOT BETWEEN '2015-08-03' AND '2015-09-11';
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement