Re: Help! SQL example needed for date comparison!

From: Andrew Thornberry <andrew.thornberry_at_mobile.belgacom.be>
Date: 1997/12/09
Message-ID: <348d5741.369524878_at_news.mobile.belgacom.be>#1/1


Perhaps your problem is that the system date includes the time in it. If your records are still in DATETIME format, then unless the time is also the same then the record will not be selected.

Perhaps you can use a select that converts the DATETIME into YYMMDD or you can put a BETWEEN statement in your where clause that defines for example between 01/01/97 00:00 and 01/01/97 23.59

Andrew

On Thu, 27 Nov 1997 14:58:34 +0100, Michal Hajek <hajek_at_nspuh.cz> wrote:

>ah262_at_detroit.freenet.org wrote:
>>
>> I am in urgent need of some SQL sample code that takes a database
>> DATETIME formatted field and compares it to the system date (minus one
>> day) for equality. I am, in effect, attempting to pull the records from
>> a table dated 1 day previous from the current system date. Sounds
>> simple, eh? I've looked at using the various date functions that Informix

>> provides, but each one is very specialized in the resulting value it
>> produces.
>
>I do not understand:
> select * from table
> where table.datecolumn=today-1
>
>does not work ?
>
>Michal
>
>--
>--------------------------------------------------------------
>Michal Hajek mailto:hajek_at_nspuh.cz
>Sprava NIS http://www.nspuh.cz
>NsP Uherske Hradiste phone : voice +420 0632 529 204
>Purkynova 365 fax +420 0632 551 014
>686 68 Uherske Hradiste Czech Republic
>--------------------------------------------------------------
Received on Tue Dec 09 1997 - 00:00:00 CET

Original text of this message