Received: from home.priority.net (home.priority.net [204.27.108.182]) by hub.org (8.9.3/8.9.3) with ESMTP id JAA15581 for ; Tue, 17 Aug 1999 09:02:37 -0400 (EDT) (envelope-from tpham@mail.priority.net) Received: by home.priority.net with Internet Mail Service (5.5.2448.0) id ; Tue, 17 Aug 1999 08:18:56 -0500 Message-ID: <551413BBBB03D111BF880060B01AACCE139F34@home.priority.net> From: "Pham, Thinh" To: "'pgsql-sql@postgreSQL.org'" Subject: RE: [SQL] datediff function Date: Tue, 17 Aug 1999 08:18:55 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2448.0) Content-Type: text/plain; charset="iso-8859-1" What happen if i just want to compare using minute only or hour only instead of day? Is there a function to do that or is postgres only work in day? T. > -----Original Message----- > From: Herouth Maoz [mailto:herouth@oumail.openu.ac.il] > Sent: Tuesday, August 17, 1999 6:05 AM > To: tjk@tksoft.com; tpham@mail.priority.net > Cc: pgsql-sql@postgreSQL.org > Subject: Re: [SQL] datediff function > > > At 02:26 +0300 on 17/08/1999, tjk@tksoft.com wrote: > > > > > > I think what you are looking for is age() > > E.g. > > > > "update schedule set purged = 0 where age('now',dayin) > > timespan('30 > >days'::reltime)" > > > > Presuming a table such as this: > > > > create table schedule (purged int, dayin datetime); > > > > This replaces "day" and "timein" with "dayin." > > Basically correct, but if there is an index on dayin, it > won't be used. The > best query to do would be > > WHERE dayin > 'now'::datetime - '30 days'::timespan; > > Herouth > > -- > Herouth Maoz, Internet developer. > Open University of Israel - Telem project > http://telem.openu.ac.il/~herutma > > >