| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Efficient date range search?
Kieran <kieran_at_dunelm.org.uk> wrote in
news:3DA1DF00.7080004_at_dunelm.org.uk:
> Pablo Sanchez wrote:
>>>Assuming you're using one of the three, the query would be: >>> >>> select count(*) from pet where died <= "date/time value" >>>
> > Unfortunately, this will count pets that haven't been born by the > date in question. > > The obvious query will be: > > select * from pet where my_date > born and (my_date < died or died > is null) > > See my other post below for some thoughts on how an RDBMS might > optimise this.
Perhaps a bad assumption on my part but I was assuming that we would only populate the table with pets that have been born. If my assumption is wrong, then you're totally right, I need to add the 'born' column in the predicate.
Thx!
-- Pablo Sanchez, High-Performance Database Engineering http://www.hpdbe.comReceived on Mon Oct 07 2002 - 14:39:26 CDT
![]() |
![]() |