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

Home -> Community -> Usenet -> comp.databases.theory -> Re: Efficient date range search?

Re: Efficient date range search?

From: Pablo Sanchez <pablo_at_dev.null>
Date: 7 Oct 2002 13:29:10 -0500
Message-ID: <Xns92A07FDFDEDCpingottpingottbah@209.189.89.243>


Pablo Sanchez <pablo_at_dev.null> wrote in news:Xns92A07011F6EE7pingottpingottbah_at_209.189.89.243:

> Assuming you're using one of the three, the query would be:
>
> select count(*) from pet where died <= "date/time value"
>

Forgot a case... the above only handles when a pet has died and you've stamped the row with the date of their ... expiration. when a pet is still alive, the assumption is that 'died' will be set to NULL and we need that in the predicate:

     SELECT count(*)
       FROM pet
      WHERE died <= <<date/time value>>
         OR died IS NULL

Sorry for any confusion.

-- 
Pablo Sanchez, High-Performance Database Engineering
http://www.hpdbe.com
Received on Mon Oct 07 2002 - 13:29:10 CDT

Original text of this message

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