Re: Efficient date range search?
From: Pablo Sanchez <pablo_at_dev.null>
Date: 7 Oct 2002 13:29:10 -0500
Message-ID: <Xns92A07FDFDEDCpingottpingottbah_at_209.189.89.243>
Date: 7 Oct 2002 13:29:10 -0500
Message-ID: <Xns92A07FDFDEDCpingottpingottbah_at_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:
Sorry for any confusion.
SELECT count(*)
FROM pet
WHERE died <= <<date/time value>>
OR died IS NULL
-- Pablo Sanchez, High-Performance Database Engineering http://www.hpdbe.comReceived on Mon Oct 07 2002 - 20:29:10 CEST