Re: [SQL] Converting column values on a select

From: "Jim Seach" <jws22(at)bellatlantic(dot)net>
To: <pgsql-sql(at)postgreSQL(dot)org>
Subject: Re: [SQL] Converting column values on a select
Date: 1999-10-13 02:09:41
Message-ID: 006b01bf1520$03938700$0a00a8c0@ws1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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 <scottsa(at)aiinet(dot)com>
To: 'pgsql-sql(at)postgreSQL(dot)org' <pgsql-sql(at)postgreSQL(dot)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
>
>************
>

Browse pgsql-sql by date

  From Date Subject
Next Message Ismail Kizir 1999-10-13 07:20:34 ERROR: unexpected SELECT query in exec_stmt_execsql()
Previous Message tjk@tksoft.com 1999-10-13 01:55:55 Re: [SQL] Converting column values on a select