"Raman Garg" <ramang@smartdatainc.com> writes:
> Actually my "between" is creating some problems and is not giving me results
> so what I have done is . IN MY WHERE CLAUSE OF QUERY:
I suspect that this revised clause will give you problems too, namely
selecting rows you don't want.
I think what may actually be happening here is that you have times
wrapping around past midnight. For instance consider
regression=# select '10:30'::time + '15 hours'::interval;?column?
----------01:30:00
(1 row)
regression=# select '10:30'::time - '15 hours'::interval;?column?
----------19:30:00
(1 row)
It seems to me that your approach to the problem is all wrong, and you
need to be using timestamp-based calculations not time-of-day-based
calculations.
regards, tom lane