Received: from smtp-out1.bellatlantic.net (smtp-out1.bellatlantic.net [199.45.39.156]) by hub.org (8.9.3/8.9.3) with ESMTP id TAA80283 for ; Tue, 12 Oct 1999 19:20:02 -0400 (EDT) (envelope-from jseach@erols.com) Received: from ws1 (adsl-151-200-16-197.bellatlantic.net [151.200.16.197]) by smtp-out1.bellatlantic.net (8.9.1/8.9.1) with SMTP id TAA03435 for ; Tue, 12 Oct 1999 19:18:29 -0400 (EDT) Message-ID: <005101bf1508$f8c142c0$0a00a8c0@ws1> From: "Jim Seach" To: Subject: Re: [SQL] Converting column values on a select Date: Tue, 12 Oct 1999 19:24:45 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.1 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Scott, Why not just use a join? Select network_equip_id, statusText, location, contact from statuses s, equipment e where s.statusValue = e.status Jim Seach -----Original Message----- From: Saltsgaver, Scott To: 'pgsql-sql@postgreSQL.org' Date: Tuesday, October 12, 1999 6:14 PM Subject: [SQL] Converting column values on a select >I was wondering if it is possible to convert a text value to an integer >value on a select to a table using another table as a conversion. I looked >into the "create rule" call but can't seem to get it to work. Of course the >code uses the numerical values for the status but I thought it would be nice >if users who performed queries against that network equipment tables could >see the nice text for the status. > >If it is possible to convert the text to a numerical is the reciprocal also >possible so again the code does not have to perform > >Here is the status conversion table: > >statusValue statusText > 2 normal > 4 critical > 7 major > >I then have a table that contains network equipment. > >network_equp_id status location contact > 20 normal 2nd floor Joe > 19 critical basement Fred > >Thanks, > >Scott Saltsgaver > >************ >