Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> For a "timestamp with time zone" column, how do I find all rows where the value is within the beginning and ending of a single date?
> If you compare a date to a timestamp, the date is taken to mean midnight
> of its day. So you need something along the line of
> WHERE timestampcol BETWEEN dateval AND dateval+1
To be exact:
| WHERE timestampcol >= dateval AND timestampcol < dateval+1
because otherwise the start of the next day is included in
the previous and therefore potentially counted twice.
Tim