I came across a strange scenario when comparing dates in postgresql (version 9.2.4 in windows). I have a column in my table saying update_date with type timestamp without a time zone. The client can search this field only with a date (for example, 2013-05-03) or with a date with time (i.e. 2013-05-03 12:20:00). This column has the value as a timestamp for all rows at the moment and has the same date (2013-05-03), but the time difference.
When I compare this column, I get different results. Like the following:
select * from table where update_date >= '2013-05-03' AND update_date <= '2013-05-03' -> No results select * from table where update_date >= '2013-05-03' AND update_date < '2013-05-03' -> No results select * from table where update_date >= '2013-05-03' AND update_date <= '2013-05-04' -> results found select * from table where update_date >= '2013-05-03' -> results found
My question is: how can I make the first query possible to get results, I mean, why does the third query work, but not the first?
Can someone help me? Thanks in advance.
date sql database postgresql
user2866264 Oct 19 '13 at 17:52 2013-10-19 17:52
source share