X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id A906A9FB1DC for ; Thu, 8 Jun 2006 00:51:24 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 34493-01-5 for ; Thu, 8 Jun 2006 00:51:15 -0300 (ADT) X-Greylist: delayed 02:15:05.752635 by SQLgrey- Received: from srv2.worldnox.net (srv2.worldnox.net [204.10.36.240]) by postgresql.org (Postfix) with ESMTP id 7A8679FB1D4 for ; Wed, 7 Jun 2006 23:44:35 -0300 (ADT) Received: from nat-ip.dynetics.com ([204.154.192.252] helo=[10.1.16.24]) by srv2.worldnox.net with esmtpa (Exim 4.52) id 1Fo8Or-00062u-3w for pgsql-sql@postgresql.org; Wed, 07 Jun 2006 20:29:25 -0400 Message-ID: <44876F63.9030302@dafunks.com> Date: Wed, 07 Jun 2006 19:29:23 -0500 From: George Handin User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Query to return modified results at runtime? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - srv2.worldnox.net X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - dafunks.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/92 X-Sequence-Number: 25328 I have a query: SELECT * FROM testtable; Where the results are: ID Color --- ------- 1 Blue 2 Red 3 Green 4 Orange How would I rewrite the query to return results where the colors are replaced by letters to give the following results? ID Color --- ------- 1 A 2 D 3 B 4 C