Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 1256C476A9F for ; Fri, 21 Jun 2002 08:36:01 -0400 (EDT) Received: from wolff.to (wolff.to [66.92.219.49]) by postgresql.org (Postfix) with SMTP id 7A594476BD8 for ; Fri, 21 Jun 2002 08:34:27 -0400 (EDT) Received: (qmail 11993 invoked by uid 500); 21 Jun 2002 12:39:19 -0000 Date: Fri, 21 Jun 2002 07:39:19 -0500 From: Bruno Wolff III To: Michael Agbaglo Cc: josh@agliodbs.com, pgsql-sql@postgresql.org Subject: Re: how to sort a birthday list ? Message-ID: <20020621123919.GA11968@wolff.to> Mail-Followup-To: Michael Agbaglo , josh@agliodbs.com, pgsql-sql@postgresql.org References: <3D122508.70104@shifted-bytes.de> <200206201703.52435.josh@agliodbs.com> <3D12E43E.3090307@shifted-bytes.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3D12E43E.3090307@shifted-bytes.de> User-Agent: Mutt/1.3.25i X-Archive-Number: 200206/291 X-Sequence-Number: 8256 On Fri, Jun 21, 2002 at 10:30:54 +0200, Michael Agbaglo wrote: > > of course you could sort by DOY but then you'll have a problem w/ the > next year: > > if it's let's say december and you select the list for the next 60 days, > persons having birthday in december will appear after persons having > birthday in january. > > I tried to use CASE WHEN... THEN in ORDER BY but it doesn't seem to work > (syntax error at '') You also need to worry about leap years. If a birthday is February 29 and there isn't one this year, what do you want to happen?