Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id DF7A9477419 for ; Thu, 20 Jun 2002 18:26:24 -0400 (EDT) Received: from ciderbox.stanaway.net (ciderbox.stanaway.net [170.76.50.98]) by postgresql.org (Postfix) with ESMTP id D393C477025 for ; Thu, 20 Jun 2002 17:33:09 -0400 (EDT) Received: by ciderbox.stanaway.net (Postfix, from userid 1000) id 7CC9D92EAE; Thu, 20 Jun 2002 16:32:51 -0500 (CDT) Subject: Re: how to sort a birthday list ? From: David Stanaway To: pgsql-sql@postgresql.org In-Reply-To: <3D122508.70104@shifted-bytes.de> References: <3D122508.70104@shifted-bytes.de> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-pF7+vS/3vWO30/nHEJsp" X-Mailer: Ximian Evolution 1.0.5 Date: 20 Jun 2002 16:32:50 -0500 Message-Id: <1024608770.9198.75.camel@ciderbox> Mime-Version: 1.0 X-Archive-Number: 200206/280 X-Sequence-Number: 8245 --=-pF7+vS/3vWO30/nHEJsp Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Thu, 2002-06-20 at 13:55, Michael Agbaglo wrote: > Hi ! >=20 > there's a nice query for retrieving the people who have their birthday=20 > in the next n days: (taken from Joe Celko's SQL for Smarties, 1st Ed.,=20 > p. 76) >=20 > SELECT * > FROM Persons > WHERE EXTRACT( YEAR FROM AGE(dateofbirth) ) < EXTRACT( YEAR FROM AGE(=20 > CURRENT_DATE+60, dateofbirth ) ) >=20 > ... but how do I sort the list ? How about: ORDER BY dateofbirth --=-pF7+vS/3vWO30/nHEJsp Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iQEXAwUAPRJKAr6yIDFGeSAyFAKPygP9GgtAVSY2xUs10SUU4SSXyWAdfsAuTKms ZCMC82nnqonElJM+x/WebMnQRNWGozulE7vB5tuF2G/0LXEbC5vzX22AhBZ3XHPW /V9TYGX5YktQ6KvrigF4zaOqqTjIgIdaNTVhz8wu7cFubNpSqT/H+sQ2hUTemZyV K/5/cy4/3f8EAKA2YEA/7yQmJO2GhSEwzoE9TR7Sy0NTj+QJvrCpi6we063oph8M f5yn/kb+6FVgX/hDvH0g+1dNaj4wTsCLVJl8j2DibU/m3KXJfpxKWC/8OD91Q7Mq xbCdK3eWrFn1U3E8hs+JLE+015ZeF0OYgCPMBOVRVBz1CUE1H+3h0Bkq =E7KR -----END PGP SIGNATURE----- --=-pF7+vS/3vWO30/nHEJsp--