pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Louise Cofield <lcofield@box-works.com>
To: 'George Weaver' <georgew1@mts.net>
To: pgsql-sql@postgresql.org
Subject: Re: Looks are important
Date: Wed, 12 Nov 2003 16:19:43 -0700
Message-ID: <003a01c3a973$743eed00$7801a8c0@Louise> (raw)
In-Reply-To: <00ac01c3a96a$a165b290$6400a8c0@Dell4500>

Try the TRIM function or the LTRIM function:
 
SELECT RPAD(no,30,' ') || TRIM(tableb.kind) FROM tablea 
WHERE tablea.kind = tableb.kind
 
Louise

-----Original Message-----
From: pgsql-sql-owner@postgresql.org
[mailto:pgsql-sql-owner@postgresql.org] On Behalf Of George Weaver
Sent: Wednesday, November 12, 2003 3:12 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] Looks are important


Hi Everyone,
 
I am trying to concatenate two fields through a query:
 
SELECT RPAD(no,30,' ') || tableb.kind FROM tablea 
WHERE tablea.kind = tableb.kind
 
The result gives (for example):
 
4595448                       Green
5966                          Yellow
106-60033                     Green
15-94-387                     Red
217-991173                    Blue
 
What I would like to have is better alignment:
 
4595448                     Green
5966                          Yellow
106-60033                  Green
15-94-387                   Red
217-991173                 Blue
 
Is there some kind of encoding or other string options that will result
in better alignment than what I've tried with Rpad?
 
Thanks in advance,
George
 
 
 
 

view thread (7+ messages)  latest in thread

Message-ID: <003a01c3a973$743eed00$7801a8c0@Louise>
Permalink:  ../003a01c3a973$743eed00$7801a8c0@Louise/
Also on:    postgresql.org/message-id/003a01c3a973$743eed00$7801a8c0@Louise

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: lcofield@box-works.com, georgew1@mts.net
  Subject: Re: Looks are important
  In-Reply-To: <003a01c3a973$743eed00$7801a8c0@Louise>

* 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