Re: select date between - PostgreSQL 9.5
От | David Rowley |
---|---|
Тема | Re: select date between - PostgreSQL 9.5 |
Дата | |
Msg-id | CAKJS1f9_cdCKkvyNe+5=gzcg_nGQAgCUr-mS+OcJxcHAajXYYg@mail.gmail.com обсуждение исходный текст |
Ответ на | select date between - PostgreSQL 9.5 (Patrick B <patrickbakerbr@gmail.com>) |
Ответы |
Re: select date between - PostgreSQL 9.5
|
Список | pgsql-general |
On 14 September 2016 at 12:20, Patrick B <patrickbakerbr@gmail.com> wrote: > I want to select all rows that have been modified from now to 4 months ago. > > I've used these queries: > >> select >> modified_date, >> from >> clients >> WHERE >> modified_date BETWEEN '2016-06-13' AND '2016-09-13' > Going by my clock here 2016-06-13 was just over 3 months ago, not 4. >> select >> modified_date, >> from >> clients >> WHERE >> modified_date >='2016-06-13' AND modified_date < '2016-09-13' > > > > But it didn't work... it returns 0 rows.... but there are rows to be shown: > > >> select modified_date from clients ORDER BY modified_date ASC > > > >> modified_date >> ------------------- >> 2015-07-11 17:23:40 >> 2016-09-13 20:00:51 >> 2016-09-13 20:00:51 >> 2016-09-13 20:00:51 >> 2016-09-13 20:00:51 > > > > What am I doing wrong? None of those dates are between your specified date range. If you want to include all of 2016-09-13 timestamps, then you'd better do < '2016-09-14' since < '2016-09-13' will only cover timestamps on the 12th or before. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
В списке pgsql-general по дате отправления: