Subject | selecting between dates with timestamps fields |
---|---|
Author | Sergio H. Gonzalez |
Post date | 2012-02-03T16:21:16Z |
Hello! I have a timestamp field with an index
how can I select the fields from a given date, but using the index?
If I do:
where
((cast (MyTimeStamp as date)) between :from_date and :to_date)
I guess that is better not to do the cast and pass the params with date
+ time.
I use Delphi and I don't know how to add the time to the date in order
to pass the parameter to the query...
I'm trying with (to get all records from Feb 2nd)
where
(MyTimeStamp between '02-01-2012 00:00:00' and '02-01-2012 23:59:59')
it uses the index, but I don't get all the records
Thanks!!!!
-s
[Non-text portions of this message have been removed]
how can I select the fields from a given date, but using the index?
If I do:
where
((cast (MyTimeStamp as date)) between :from_date and :to_date)
I guess that is better not to do the cast and pass the params with date
+ time.
I use Delphi and I don't know how to add the time to the date in order
to pass the parameter to the query...
I'm trying with (to get all records from Feb 2nd)
where
(MyTimeStamp between '02-01-2012 00:00:00' and '02-01-2012 23:59:59')
it uses the index, but I don't get all the records
Thanks!!!!
-s
[Non-text portions of this message have been removed]