From: | Patrick B <patrickbakerbr(at)gmail(dot)com> |
---|---|
To: | David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: select date between - PostgreSQL 9.5 |
Date: | 2016-09-14 02:49:36 |
Message-ID: | CAJNY3itc0ZESzqJG3kHiyP0Q0pwTy0PenkKYVxg5EdwNRfATcQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
2016-09-14 13:17 GMT+12:00 David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>:
> On 14 September 2016 at 12:20, Patrick B <patrickbakerbr(at)gmail(dot)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
>
Thanks guys...
I've used < and >
not sure why wasn't working before :(
Thanks!
Patrick
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2016-09-14 03:23:48 | Re: Installing 9.6 RC on Ubuntu [Solved] |
Previous Message | David Rowley | 2016-09-14 01:17:24 | Re: select date between - PostgreSQL 9.5 |