Received: from xyzzy.lan.internal (turbo-173.kingston.net [216.123.190.173]) by postgresql.org (Postfix) with ESMTP id 104954762E3 for ; Tue, 12 Mar 2002 12:24:24 -0500 (EST) Received: from drew by xyzzy.lan.internal with local (Exim 3.35 #1 (Debian)) id 16kq0Z-0005BI-00; Tue, 12 Mar 2002 12:24:19 -0500 Date: Tue, 12 Mar 2002 12:24:19 -0500 To: Gary Stainburn Cc: pgsql-sql Subject: Re: in-date news items Message-ID: <20020312172419.GA19889@xyzzy.dhs.org> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="OXfL5xGRrasGEqWY" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.27i From: "Andrew G. Hammond" X-Fnord: +++ath X-WebTV-Stationery: Standard; BGColor=black; TextColor=black X-Message-Flag: Message text blocked: ANTI-MICROSOFT OPINIONS X-BeenThere: drew@xyzzy.dhs.org X-Archive-Number: 200203/119 X-Sequence-Number: 7000 --OXfL5xGRrasGEqWY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 12, 2002 at 12:17:05PM +0000, Gary Stainburn wrote: > Hi all, >=20 > I'm trying to use a select to get the latest item of news, provided that = it's=20 > within the last X days. What do I need to add to the where clause for th= e=20 > select statement below: >=20 > select ndate, nauthor, nheading > from news > order by ndate desc > limit 1 > *** where ndate within the last 3 months ****** you'll laugh when you see this... :) WHERE ndate > 'now'::datetime - '3 months'::interval; --=20 Andrew G. Hammond mailto:drew@xyzzy.dhs.org http://xyzzy.dhs.org/~drew/ 56 2A 54 EF 19 C0 3B 43 72 69 5B E3 69 5B A1 1F 613-389-5481= =20 5CD3 62B0 254B DEB1 86E0 8959 093E F70A B457 84B1 "To blow recursion you must first blow recur" -- me --OXfL5xGRrasGEqWY Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iEYEARECAAYFAjyOOcMACgkQCT73CrRXhLH/YgCfSmd+Two03yfGxcFjm3ozdVgV EEkAoIVN2hb6qGDZfJP6fhhZHKmKoeWS =XPbR -----END PGP SIGNATURE----- --OXfL5xGRrasGEqWY--