Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id CA43A9FB543 for ; Thu, 7 Jun 2007 18:48:08 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 19292-04 for ; Thu, 7 Jun 2007 18:47:58 -0300 (ADT) X-Greylist: delayed 00:06:38.325612 by SQLgrey-1.7.5 Received: from web60816.mail.yahoo.com (web60816.mail.yahoo.com [209.73.178.224]) by postgresql.org (Postfix) with SMTP id 3F5FC9FB4F7 for ; Thu, 7 Jun 2007 18:48:04 -0300 (ADT) Received: (qmail 3284 invoked by uid 60001); 7 Jun 2007 21:41:21 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.br; h=X-YMail-OSG:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=MS8ZEfjSa8kmdiLl0l2P0TUrrHyGCXRUFBn0RoxwWgm3qpxp0JOzkh/eBd4KFmy/j367Vkhr2gwjBvrZtlfV01+DqLGjVRvppk6Ki2zeieC2/H4FlfO5qQMQeJwznWFFT+ud3VWAi62yoUKUQuyhionLKxHNxF2APUY/fsE1Mww=; X-YMail-OSG: VdhnRb4VM1kA3lTqeWw5lcGPEJUWFdw65_tSLHik5sfs19VwoX8clJ93Tl16BoEx.E1VUl9rELtFrSWNowjFwA.jqn0riNWv3t8cY7V2KDAXVn2omM33szueWhi3.58- Received: from [201.37.35.220] by web60816.mail.yahoo.com via HTTP; Thu, 07 Jun 2007 18:41:21 ART Date: Thu, 7 Jun 2007 18:41:21 -0300 (ART) From: Osvaldo Kussama Subject: Re: subtract a day from the NOW function To: "Campbell, Lance" Cc: pgsql-sql@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <276697.3120.qm@web60816.mail.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200706/69 X-Sequence-Number: 28559 --- "Campbell, Lance" escreveu: > Table > > Field "some_timestamp" is a timestamp. > > > > In a "WHERE" statement I need to compare a timestamp > field in a table > "some_timestamp" to now() - one day. > > > > Example: > > > > SELECT some_timestamp WHERE to_char(some_timestamp, > 'YYYYMMDD') > > (to_char(now(), 'YYYYMMDD') - 1 day); > > > > The statement "to_char(now(), 'YYYYMMDD') - 1 day)" > is obviously > incorrect. I just need to know how to form this in > a way that will > work. > > > > If there is an entirely different solution I am all > for it. Do note > that I started down this path because I want to > exclude the hour, > minutes and seconds found in the field > "some_timestamp" and in the > function now(). > Try: SELECT some_timestamp WHERE some_timestamp > 'yesterday'::timestamp; Look 8.5.1.5. Special Values at: http://www.postgresql.org/docs/8.2/interactive/datatype-datetime.html []s Osvaldo ____________________________________________________________________________________ Novo Yahoo! Cadê? - Experimente uma nova busca. http://yahoo.com.br/oqueeuganhocomisso