Re: Help! SQL example needed for date comparison!

From: Oliver <oamudipe_at_erols.com>
Date: 1997/11/27
Message-ID: <347E4B04.2A4B_at_erols.com>#1/1


ah262_at_detroit.freenet.org wrote:
>
> Hello from Michigan!
>
> I am old-time "Big Iron" programmer, new to SQL and the Informix
> relational database, and am in need of some _simple_ sample code.
>
> 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.
>
> Unfortunately, all I have available to me is the Informix tutorial,
> reference, and syntax manuals, and none of these even come remotely close
> to defining the code for such a simple task.
>
> Any help you can provide would be most appreciated on this. If you know
> of any good SQL tutorial books with Informix hooks shown in it I would
> also appreciate knowing about those.
>
> Happy Thanksgiving!
>
> Todd
>
> -------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet

I believe this is what you are asking. It compares the previous day (which will be yesterday) with a datetime column from your target table.

select *
from pubs2.dbo.publishers
where pub_date = dateadd(dd,-1,getdate()) Received on Thu Nov 27 1997 - 00:00:00 CET

Original text of this message