Select records from dates range in postgresql

We can simply use < (less than) and > (greater than) operators to find out records from specific tables in postgre.

Example (select all records)

SELECT * FROM "dummyTable";
1	anytext1        2012-10-15
2	aummy text 2    2013-01-11
3	dummy text 3    2011-07-19
4	any text 6      2012-05-15

Selecting records from range of dates

Format is : <year>-<month>-<day>

SELECT * FROM "dummyTable" WHERE "theDatefield" < '2014-12-01' AND "theDatefield" > '2012-01-30'
1	anytext1        2012-10-15
2	aummy text 2    2013-01-11
4	any text 6      2012-05-15
Share

You may also like...