I need to look up rows within a particular time frame.
select *
from TableA
where startdate >= '12-01-2012 21:24:00'
and startdate <= '12-01-2012 21:25:33'
I.e.: I need to look up rows with timestamp precision of SECONDS. How do I achieve this?
FYI: The startdate column is of type TIMESTAMP.
to_timestamp()
You need to use
to_timestamp()to convert your string to a propertimestampvalue:to_date()
If your column is of type
DATE(which also supports seconds), you need to useto_date()Example
To get this into a
wherecondition use the following:Note
You never need to use
to_timestamp()on a column that is of typetimestamp.