pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Amanda Riera <amanda@labtie.mmt.upc.es>
To: pgsql <pgsql-sql@postgresql.org>
Subject: Concatenate fields
Date: Wed, 11 Apr 2001 13:31:05 +0200
Message-ID: <3AD44079.FCFE4583@labtie.mmt.upc.es> (raw)


Hi all,
using PgSQL 7.0.3

I would like concatenate some fields to have all information in just
one field. I'm doing this below:

CREATE TABLE bill_2col AS
SELECT  bill.bill_id,
 (trim(text(bill.bill_number)) || ' | ' ||
  trim(text(provider.company)) || ' | ' ||
  trim(to_char(bill.issue_date,'MM/DD/YY')) || ' | ' ||
  trim(to_char(bill.amount,'9999999.99')) || ' pts') AS billdesc
FROM bill, provider
WHERE   bill.provider_id = provider.provider_id
ORDER BY bill.bill_id;

When it finds some empty field, it makes all the new field empty, no
matters
if the other are empty or not.

Here you have the result table

 bill_id |                           billdesc
---------+---------------------------------------------------------------

       0 | Unknown | Unknown | 01/01/00 | .00 pts
       1 | 98018097 | SUMI Informática | 12/22/99 | 1823520.00 pts
       2 |
       3 | 99018089 | PISTA CERO S.L | 12/01/99 | 1949380.00 pts
       4 | 99018089 | DataSystem Informática | 12/01/99 | 1949380.00 pts

       5 |
       6 |







view thread (3+ messages)  latest in thread

Message-ID: <3AD44079.FCFE4583@labtie.mmt.upc.es>
Permalink:  ../3AD44079.FCFE4583@labtie.mmt.upc.es/
Also on:    postgresql.org/message-id/3AD44079.FCFE4583@labtie.mmt.upc.es

 · 

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-sql@postgresql.org
  Cc: amanda@labtie.mmt.upc.es
  Subject: Re: Concatenate fields
  In-Reply-To: <3AD44079.FCFE4583@labtie.mmt.upc.es>
  References: <3AD44079.FCFE4583@labtie.mmt.upc.es>

* 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