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 4ED1E9FB3B4 for ; Tue, 12 Sep 2006 16:19:40 -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 63387-06-2 for ; Tue, 12 Sep 2006 19:17:07 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.182]) by postgresql.org (Postfix) with ESMTP id 526069FB292 for ; Tue, 12 Sep 2006 16:07:24 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id d80so2757249pyd for ; Tue, 12 Sep 2006 12:07:23 -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=do9cSMj8VEyPs/fe31W9Q/puCMz3RenFJep3ZQYfZXTFSHSXtabnRIXKLeofAFVER98L8oLACCJvdsAIs9kSriPRdeimqAzsgVXt4FW37gwh/HEkon/EeHtLsdcywTztuFB/Wnti1ZcRTppwJBKoW6r/F8cRVHvW94o7AXc5rXc= Received: by 10.35.88.18 with SMTP id q18mr11418312pyl; Tue, 12 Sep 2006 12:07:23 -0700 (PDT) Received: by 10.35.80.9 with HTTP; Tue, 12 Sep 2006 12:07:22 -0700 (PDT) Message-ID: Date: Tue, 12 Sep 2006 14:07:22 -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: <20060912182941.4129.qmail@web53508.mail.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_5775_15898905.1158088042585" References: <20060912182941.4129.qmail@web53508.mail.yahoo.com> X-Google-Sender-Auth: 05816193fdd2de5f X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.496 tagged_above=0 required=5 tests=HTML_40_50, HTML_MESSAGE, SPF_PASS X-Spam-Level: X-Archive-Number: 200609/100 X-Sequence-Number: 23014 ------=_Part_5775_15898905.1158088042585 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 9/12/06, Allan Kamau wrote: > > Hi all, > This is a plain simple sql question appologies for > posting it here. > > Am looking for a way of combining values from several > fields(and introducting value separators). > > select field2+"_"+field1 from tableA; > > I've tried > select field2||'_'||field1 from tableA; > I get "1" as the result(which is not what I want). What does tableA look like (DDL and the data)? ================================================================== Aaron Bono Aranya Software Technologies, Inc. http://www.aranya.com http://codeelixir.com ================================================================== ------=_Part_5775_15898905.1158088042585 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:
Hi all,
This is a plain simple sql question appologies for
posting it here.

Am looking for a way of combining values from several
fields(and introducting value separators).

select field2+"_"+field1 from tableA;

I've tried
select field2||'_'||field1 from tableA;
I get "1" as the result(which is not what I want).

 
What does tableA look like (DDL and the data)?

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