pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: NRonayette <r97m10@socotec.fr>
To: Travis Bauer <trbauer@indiana.edu>
Cc: pgsql-general@postgresql.org
Subject: Re: SQL question
Date: Mon, 10 Jul 2000 13:27:43 +0100
Message-ID: <3969C13F.68F1506E@socotec.fr> (raw)
References: <Pine.GSO.4.21.0007100535040.11005-100000@mantaray.cs.indiana.edu>



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



view thread (71+ messages)  latest in thread

Message-ID: <3969C13F.68F1506E@socotec.fr>
Permalink:  ../3969C13F.68F1506E@socotec.fr/
Also on:    postgresql.org/message-id/3969C13F.68F1506E@socotec.fr

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: r97m10@socotec.fr, trbauer@indiana.edu
  Subject: Re: SQL question
  In-Reply-To: <3969C13F.68F1506E@socotec.fr>
  References: <Pine.GSO.4.21.0007100535040.11005-100000@mantaray.cs.indiana.edu> <3969C13F.68F1506E@socotec.fr>

* 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