pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Case with Char(1)
4+ messages / 3 participants
[nested] [flat]

* Case with Char(1)
@ 2007-02-28 13:02  Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>
  0 siblings, 2 replies; 4+ messages in thread

From: Ezequias Rodrigues da Rocha @ 2007-02-28 13:02 UTC (permalink / raw)
  To: pgsql-sql

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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Case with Char(1)
@ 2007-02-28 13:18  Andrew Sullivan <ajs@crankycanuck.ca>
  parent: Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>
  1 sibling, 1 reply; 4+ messages in thread

From: Andrew Sullivan @ 2007-02-28 13:18 UTC (permalink / raw)
  To: pgsql-sql

On Wed, Feb 28, 2007 at 10:02:38AM -0300, Ezequias Rodrigues da Rocha wrote:
> Hi list,
> 
> it is possible to use case with character (1) ?
> 
> I am having problems to formate the SQL statement.

Your example looked like it worked.

A

-- 
Andrew Sullivan  | ajs@crankycanuck.ca
Users never remark, "Wow, this software may be buggy and hard 
to use, but at least there is a lot of code underneath."
		--Damien Katz



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Case with Char(1)
@ 2007-02-28 13:30  Peter Eisentraut <peter_e@gmx.net>
  parent: Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Peter Eisentraut @ 2007-02-28 13:30 UTC (permalink / raw)
  To: pgsql-sql; +Cc: Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>

Am Mittwoch, 28. Februar 2007 14:02 schrieb Ezequias Rodrigues da Rocha:
> it is possible to use case with character (1) ?

Have you tried it?

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Case with Char(1)
@ 2007-02-28 14:10  Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>
  parent: Andrew Sullivan <ajs@crankycanuck.ca>
  0 siblings, 0 replies; 4+ messages in thread

From: Ezequias Rodrigues da Rocha @ 2007-02-28 14:10 UTC (permalink / raw)
  To: Andrew Sullivan <ajs@crankycanuck.ca>; +Cc: pgsql-sql

Now it is working. Thank you for your interest.
Ezequias

2007/2/28, Andrew Sullivan <ajs@crankycanuck.ca>:
> On Wed, Feb 28, 2007 at 10:02:38AM -0300, Ezequias Rodrigues da Rocha wrote:
> > Hi list,
> >
> > it is possible to use case with character (1) ?
> >
> > I am having problems to formate the SQL statement.
>
> Your example looked like it worked.
>
> A
>
> --
> Andrew Sullivan  | ajs@crankycanuck.ca
> Users never remark, "Wow, this software may be buggy and hard
> to use, but at least there is a lot of code underneath."
>                 --Damien Katz
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
>        subscribe-nomail command to majordomo@postgresql.org so that your
>        message can get through to the mailing list cleanly
>


-- 
 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                                  Atenciosamente (Sincerely)
                        Ezequias Rodrigues da Rocha
 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
A pior das democracias ainda é melhor do que a melhor das ditaduras
The worst of democracies is still better than the better of dictatorships
http://ezequiasrocha.blogspot.com/



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2007-02-28 14:10 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-02-28 13:02 Case with Char(1) Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>
2007-02-28 13:18 ` Andrew Sullivan <ajs@crankycanuck.ca>
2007-02-28 14:10   ` Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>
2007-02-28 13:30 ` Peter Eisentraut <peter_e@gmx.net>

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