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 |





---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Reply via email to