From: sblack@elsouth.com (Scott Black)
Subject: RE: Help!  SQL example needed for date comparison!
Date: 1997/12/12
Message-ID: <66s3i6$b9s@cssun.mathcs.emory.edu>#1/1
Sender: walt@mathcs.emory.edu
X-Informix-List-ID: <list.17844>
Reply-To: sblack@elsouth.com (Scott Black)
Distribution: world
Organization: Mailing List Gateway
Newsgroups: comp.databases.informix



Try
select * from telephone_book where date(my_datetime) = today -1

} -----Original Message-----
} From:	gil@gilbaby.dinoco.de [SMTP:gil@gilbaby.dinoco.de]
} Sent:	Friday, December 12, 1997 12:22 PM
} To:	informix-list@rmy.emory.edu
} Subject:	Re: Help!  SQL example needed for date comparison!
} 
} An example for sybase would be:
} 
} select * from telephone_book where datediff(dd,my_datetime,getdate())
} = 1 
} 
} : >ah262@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@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
} : >--------------------------------------------------------------
} 
} 
} --
} **********************************************************************
} ****
} Gil Payson
} gil@gilbaby.dinoco.de
} g.payson@edina.xnc.com
} grp@geac.com
} **********************************************************************
} ****


