Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: getting records for 1 day

Re: getting records for 1 day

From: Paul Lautman <paul.lautman_at_btinternet.com>
Date: Sun, 4 Nov 2007 17:05:29 -0000
Message-ID: <5p6cemFprm9eU1@mid.individual.net>


VC wrote:
>> in SQL, i wonder if I do a
>>
>>
>> select * from tablefoo where add_date = "2007-11-01"
>>
>>
>> then it may not show any record as it will only match recorded added
>> exactly at 2007-11-01 00:00:00
>> so to limit that day, I could use
>>
>> select * from tablefoo where date(add_date) = "2007-11-01"
>>
>> except I think if the table has millions of records, then it can take
>> forever to run, as it will go through all records and apply the date
>> function on each record's add_date.
>>
>> so the following
>>
>> select * from tablefoo where add_date >= "2007-11-01" and add_date <
>> "2007-11-02"
>>
>> should work... except it is quite verbose... i wonder if there is a
>> better way?
> Try this.
>
> select * from tablefoo
> where convert(varchar, add_date, 101) = '11/01/2007'
>
>
> "Summercool" <Summercoolness_at_gmail.com> wrote in message
> news:1194176707.385279.102190_at_t8g2000prg.googlegroups.com...
Please do not top post - top posting fixed.

Why is your suggestion any better than the OP's date() function call? Received on Sun Nov 04 2007 - 11:05:29 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US