X-Original-To: pgsql-admin-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id F109B9FA4D7 for ; Tue, 12 Sep 2006 17:16:33 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 84622-04-2 for ; Tue, 12 Sep 2006 20:12:53 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.180]) by postgresql.org (Postfix) with ESMTP id 393279F931A for ; Tue, 12 Sep 2006 17:09:10 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id d80so2774442pyd for ; Tue, 12 Sep 2006 13:08:36 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=i8qF9UCzdho/ShggEE4kiyT9GDv1/2Kdf5SBcf2E1NAt59Xhn9cL8xRAcCG/NN2WynndjcGvsgOhxuZ7w8Kjp3z6knRZT2CnJvqaz9BLQHnzf0axcbdWTJrfTBCwoJRXNqSJ8YmGZfeOkKP1vefi2I5YmWhaWKTYTiiXM+eji4s= Received: by 10.35.9.2 with SMTP id m2mr11512610pyi; Tue, 12 Sep 2006 13:08:35 -0700 (PDT) Received: by 10.35.80.9 with HTTP; Tue, 12 Sep 2006 13:08:35 -0700 (PDT) Message-ID: Date: Tue, 12 Sep 2006 15:08:35 -0500 From: "Aaron Bono" To: "Allan Kamau" Subject: Re: Combining output of several fields in SQL query Cc: pgsql-admin@postgresql.org In-Reply-To: <20060912192628.63526.qmail@web53510.mail.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_7151_26112029.1158091715701" References: <20060912192628.63526.qmail@web53510.mail.yahoo.com> X-Google-Sender-Auth: b87f222e85adc4e7 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.134 tagged_above=0 required=5 tests=HTML_50_60, HTML_MESSAGE, SPF_PASS X-Spam-Level: X-Archive-Number: 200609/104 X-Sequence-Number: 23018 ------=_Part_7151_26112029.1158091715701 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 9/12/06, Allan Kamau wrote: > > create table tableA( > s_l_p_p_v_i text not null, > field1 text not null, > field2 text not null, > primary key(field1,field2)); > > s_l_p_p_v_i field1 field1 > abc 2 1 > xyz 2 4 > klm 2 3 Your initial query: select field2||'_'||field1 from tableA; works perfectly for me: ?column? 4_2 1_2 3_2 Are you sure you are not getting the correct results? ================================================================== Aaron Bono Aranya Software Technologies, Inc. http://www.aranya.com http://codeelixir.com ================================================================== ------=_Part_7151_26112029.1158091715701 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 9/12/06, Allan Kamau <kamauallan@yahoo.com> wrote:
create table tableA(
s_l_p_p_v_i text not null,
field1 text not null,
field2 text not null,
primary key(field1,field2));

s_l_p_p_v_i field1 field1
abc         2      1
xyz         2      4
klm         2      3

Your initial query:

select field2||'_'||field1 from tableA;

works perfectly for me:

?column?
4_2
1_2
3_2

Are you sure you are not getting the correct results?

==================================================================
   Aaron Bono
   Aranya Software Technologies, Inc.
   http://www.aranya.com
   http://codeelixir.com
================================================================== ------=_Part_7151_26112029.1158091715701--