pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Case with Char(1)
Date: Wed, 28 Feb 2007 10:02:38 -0300
Message-ID: <55c095e90702280502x3673fe6g67e7cb5de714356f@mail.gmail.com> (raw)

Hi list,

it is possible to use case with character (1) ?

I am having problems to formate the SQL statement.

I have:

SELECT * FROM test;

 a
---
 A
 B
 C


SELECT a,
       CASE WHEN a='A' THEN 'one'
            WHEN a='B' THEN 'two'
            ELSE 'other'
       END
    FROM test;

 a | case
---+-------
 A | one
 B | two
 C | other

I know from all program languages that case do not apply to noun
sequencialiable (if this word exists) variable (like integers etc).

Any help would be greatfull.

Thanks in advance
Ezequias



view thread (4+ messages)  latest in thread

Message-ID: <55c095e90702280502x3673fe6g67e7cb5de714356f@mail.gmail.com>
Permalink:  ../55c095e90702280502x3673fe6g67e7cb5de714356f@mail.gmail.com/
Also on:    postgresql.org/message-id/55c095e90702280502x3673fe6g67e7cb5de714356f@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ezequias.rocha@gmail.com
  Subject: Re: Case with Char(1)
  In-Reply-To: <55c095e90702280502x3673fe6g67e7cb5de714356f@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox