Re: SQL question

From: NRonayette <r97m10(at)socotec(dot)fr>
To: Travis Bauer <trbauer(at)indiana(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SQL question
Date: 2000-07-10 12:27:43
Message-ID: 3969C13F.68F1506E@socotec.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Travis Bauer a écrit :
>
> Is it possible to return a column in an sql statement which concantenates
> two other columns and adds some other characters. For example:
>
> create table t1 (x int, y int);
> insert into t1 values(1,2);
> select ???? as nifty from t1;
>
> nifty
> -----
> 1/2
>
> What should I put in for the ???? ?

select t1.x||'/'||t1.y from t1;

this should work. If you can't concatenate int with char (t1.x with
'/'), you must use a function to convert int in char If "to_char" is the
name of this function, ???? became : to_char(t1.x)||'/'||to_char(t1.y)

Nicolas

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Philip Warner 2000-07-10 12:34:02 RE: PostgreSQL & the BSD License
Previous Message Robert D. Nelson 2000-07-10 12:24:00 RE: PostgreSQL & the BSD License