X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 599949DD20B for ; Wed, 7 Dec 2005 23:17:24 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86015-08 for ; Wed, 7 Dec 2005 23:17:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp-send.myrealbox.com (smtp-send.myrealbox.com [151.155.5.143]) by postgresql.org (Postfix) with ESMTP id 3DB749DD075 for ; Wed, 7 Dec 2005 23:17:21 -0400 (AST) Received: from [172.16.1.181] grzm [61.197.227.146] by smtp-send.myrealbox.com with NetMail SMTP Agent $Revision: 1.6 $ on Linux via secured & encrypted transport (TLS); Wed, 07 Dec 2005 20:17:25 -0700 In-Reply-To: <43979459.9020500@NarrowPathInc.com> References: <43979459.9020500@NarrowPathInc.com> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: pgsql-sql@postgresql.org Content-Transfer-Encoding: 7bit From: Michael Glaesemann Subject: Re: dow question Date: Thu, 8 Dec 2005 12:17:22 +0900 To: KeithW@NarrowPathInc.com X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/66 X-Sequence-Number: 23608 On Dec 8, 2005, at 11:03 , Keith Worthington wrote: > Is there a better way to do this? The CASE seems inefficient and > wordy but perhaps not. > > I was hoping for > > day_name(tbl_detail.ship_by_date) || tbl_detail.ship_by_date::text > AS sort_by_string > > but AFAIK day_name(date) or something like it is merely my > fantasy. ;-) Will to_char() do what you want? Something like test=# select to_char(current_date, 'Day YYYY-MM-DD'); to_char ---------------------- Thursday 2005-12-08 (1 row) http://www.postgresql.org/docs/current/interactive/functions- formatting.html Michael Glaesemann grzm myrealbox com