Concatenate fields

Поиск
Список
Период
Сортировка
От Amanda Riera
Тема Concatenate fields
Дата
Msg-id 3AD44079.FCFE4583@labtie.mmt.upc.es
обсуждение исходный текст
Ответы Re: Concatenate fields  ("Oliver Elphick" <olly@lfix.co.uk>)
Список pgsql-sql
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 |






В списке pgsql-sql по дате отправления:

Предыдущее
От: George Moga
Дата:
Сообщение: Re: problem with copy command
Следующее
От: "Oliver Elphick"
Дата:
Сообщение: Re: problem with copy command