X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id EBE4FD1B4F2 for ; Thu, 13 Nov 2003 03:15:44 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 28880-10 for ; Wed, 12 Nov 2003 23:15:17 -0400 (AST) Received: from smtp2.mts.net (smtp2.mts.net [205.200.16.113]) by svr1.postgresql.org (Postfix) with ESMTP id BA232D1B54F for ; Wed, 12 Nov 2003 23:15:12 -0400 (AST) Received: from Dell4500 (wnpgmb01bbz-ac04-12-178.dial.mts.net [142.161.12.178]) by smtp2.mts.net (8.12.8-20030918/8.11.3) with SMTP id hAD3F9BJ009603; Wed, 12 Nov 2003 21:15:10 -0600 (CST) Message-ID: <002c01c3a994$5ba611d0$6400a8c0@Dell4500> From: "George Weaver" To: "Josh Berkus" , , "Louise Cofield" References: <003a01c3a973$743eed00$7801a8c0@Louise> Subject: Re: Looks are important Date: Wed, 12 Nov 2003 21:14:34 -0600 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0029_01C3A961.F8945B60" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/146 X-Sequence-Number: 15961 This is a multi-part message in MIME format. ------=_NextPart_000_0029_01C3A961.F8945B60 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MessageHi Louise, Josh, Thanks for the suggestions. What I'm trying to accomplish is to have a space between no and kind. Leng= th(no) can vary. I would like all the kinds to line up evenly when display= ed, with a space between no and kind. But when I RPAD no (to try and get a= n even starting point for kind), the ' 's are not quite the same width as= an ordinary number or letter. Thus the physical display length of "30 cha= racters" (padded) can vary from row to row. The result is that the kinds do= n't necessary line up neatly. I need to concatenate the two as they are be= ing displayed as one column in a drop down combobox. Is what I'm trying to do possible??? George ----- Original Message -----=20 From: Louise Cofield=20 To: 'George Weaver' ; pgsql-sql@postgresql.org=20 Sent: Wednesday, November 12, 2003 5:19 PM Subject: RE: [SQL] Looks are important Try the TRIM function or the LTRIM function: SELECT RPAD(no,30,' ') || TRIM(tableb.kind) FROM tablea=20 WHERE tablea.kind =3D 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=20 WHERE tablea.kind =3D 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 ------=_NextPart_000_0029_01C3A961.F8945B60 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message
Hi Louise, Josh,
 
Thanks for the suggestions.
 
What I'm trying to accomplish is to have a= space=20 between no and kind.  Length(no) can vary.  I would like all the = kinds=20 to line up evenly when displayed, with a space between no and kind.&nb= sp;=20 But when I RPAD no (to try and get an even starting point for kind), &= nbsp;=20 the ' 's are not quite the same width as an ordinary number or letter. = ;=20 Thus the physical display length of "30 characters" (padded) can vary from = row=20 to row. The result is that the kinds don't necessary line up neatly.  = I=20 need to concatenate the two as they are being displayed as one column in a = drop=20 down combobox.
 
Is what I'm trying to do possible???
 
George
----- Original Message -----
Fro= m:=20 = Louise=20 Cofield
To: 'George Weaver' ; pgsql-sql@postgresql.org
Sent: Wednesday, November 12, 2003= 5:19=20 PM
Subject: RE: [SQL] Looks are=20 important

Try the TRIM fun= ction or=20 the LTRIM function:
 
SELECT RPAD(no,30,' ') || TRIM(tableb.kind) FROM&nbs= p;tablea 
WHERE tablea.kind =3D tableb.kind
 
Louise
<= FONT=20 face=3DTahoma size=3D2>-----Original Message-----
From: pgsql-sql-owner@postgres= ql.org=20 [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of George=20 Weaver
Sent: Wednesday, November 12, 2003 3:12 PM
To: pgsql-sql@postgresql.orgSubject:=20 [SQL] Looks are important

Hi Everyone,
 
I am trying to concatenate two fields = through a=20 query:
 
SELECT=20 RPAD(no,30,' ') || tableb.kind FROM&nb= sp;tablea 
WHERE tablea.kind =3D=20 tableb.kind
 
The result gives (for= =20 example):
 
4595448         &= nbsp;           &nbs= p;=20 Green
5966         &nbs= p;            &= nbsp;  =20 Yellow
106-60033        &nbs= p;           =20 Green
15-94-387         = ;           =20 Red
217-991173         =           =20 Blue
 
What I would like to ha= ve is=20 better alignment:
 
4595448         &= nbsp;           Gree= n
5966           =             &nb= sp; =20 Yellow
106-60033        &nbs= p;         Green
15-94-387&= nbsp;           &nbs= p;      Red
217-991173   &n= bsp;            = ; Blue
 
Is there some kind of encoding or othe= r string=20 options that will result in better alignment than what I've tried with= =20 Rpad?
 
Thanks in advance,
George
 
 
 
 
------=_NextPart_000_0029_01C3A961.F8945B60--