From suresh.g@zensar.com Fri Mar 13 07:20:02 2009 Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id B147E634239 for ; Fri, 13 Mar 2009 04:20:02 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 83434-07 for ; Fri, 13 Mar 2009 04:19:52 -0300 (ADT) X-Greylist: delayed 00:18:10.65223 by SQLgrey-1.7.6 Received: from mailrelay.zensar.com (unknown [220.225.45.73]) by mail.postgresql.org (Postfix) with ESMTP id AE8C163246F for ; Fri, 13 Mar 2009 04:19:51 -0300 (ADT) thread-index: Acmjqaw6OwQyoaB7R1S/zJ75UY2inQ== Received: from BRIDGEHEAD.ind.zensar.com ([10.42.2.95]) by mailrelay.zensar.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 13 Mar 2009 12:32:29 +0530 Content-Transfer-Encoding: 7bit Received: from zenmailfe.ind.zensar.com ([10.42.2.88]) by BRIDGEHEAD.ind.zensar.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 13 Mar 2009 12:32:05 +0530 Received: from BATELCWDESK1094 ([10.41.100.205]) by zenmailfe.ind.zensar.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 13 Mar 2009 12:32:05 +0530 Content-Class: urn:content-classes:message Importance: normal Message-ID: <004001c9a3a9$9e715dc0$cd64290a@ind.zensar.com> From: "suresh gupta" To: Subject: Query related Date: Fri, 13 Mar 2009 12:32:05 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_003D_01C9A3D7.B7FC4830" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4133 X-OriginalArrivalTime: 13 Mar 2009 07:02:05.0538 (UTC) FILETIME=[9E2DEC20:01C9A3A9] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.101 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001, RDNS_NONE=0.1 X-Spam-Level: X-Archive-Number: 200903/157 X-Sequence-Number: 31657 This is a multi-part message in MIME format. ------=_NextPart_000_003D_01C9A3D7.B7FC4830 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi Team, I had a table with 2 fields like First name(FN) and last name(LN). When = I give a query for the records of the 2 columns, they are displaying in = 2 different columns. My requirement is to combine both the columns in a = single one. As per my knowledge there are some operators which combine 2 = columns and display together in single columns like |, +, etc. in other = databases like Oracle. For example FN =3D Suresh and LN=3DGupta the output of the query should = be Suresh Gupta in single column.=20 Is there any similar operator or method on postgresql to get my result. = Please advice. Pgsql version is 8.1 and window version software. Regards, G. V. Suresh Gupta -------------------------------------------------------------------------= ------- GTS - EMEIA, Zensar Technologies=20 Zensar Knowledge Park, Plot#5, MIDC IT Tower,=20 Kharadi, Off Nagar Road, Pune - 411014 Landline : +91-20-66453471 | +91-9890898688 Email : suresh.g@zensar.com | website: www.zensar.com=20 DISCLAIMER: This email may contain confidential or privileged information for the = intended recipient(s) and the views expressed in the same are not = necessarily the views of Zensar Technologies Ltd. If you are not the = intended recipient or have received this e-mail by error, its use is = strictly prohibited, please delete the e-mail and notify the sender. = Zensar Technologies Ltd. does not accept any liability for virus = infected mails.=20 ------=_NextPart_000_003D_01C9A3D7.B7FC4830 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi Team,
 
I had a table with 2 fields like First = name(FN) and=20 last name(LN). When I give a query for the records of the 2 columns,=20 they are displaying in 2 different columns. My requirement is to = combine=20 both the columns in a single one. As per my knowledge there are some = operators=20 which combine 2 columns and display together in single columns like |, = +, etc.=20 in other databases like Oracle.
For example FN =3D Suresh = and LN=3DGupta the=20 output of the query should be Suresh Gupta in single = column. 
 
Is there any similar operator or method = on=20 postgresql to get my result. Please advice.
 
Pgsql version is 8.1 and window version = software.


Regards,
G. V.=20 Suresh Gupta

GTS - EMEIA, Zensar Technologies
Zensar Knowledge Park, = Plot#5, MIDC=20 IT Tower,
Kharadi, Off Nagar Road, Pune - 411014
Landline :=20 +91-20-66453471 | +91-9890898688
Email : suresh.g@zensar.com | website: = www.zensar.com =

DISCLAIMER:
This email may contain confidential = or privileged information for the intended recipient(s) and the views = expressed in the same are not necessarily the views of Zensar = Technologies Ltd. If you are not the intended recipient or have received = this e-mail by error, its use is strictly prohibited, please delete the = e-mail and notify the sender. Zensar Technologies Ltd. does not accept = any liability for virus infected mails. ------=_NextPart_000_003D_01C9A3D7.B7FC4830-- From ashishka@synechron.com Fri Mar 13 07:36:55 2009 Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id C9D3E63475C for ; Fri, 13 Mar 2009 04:36:55 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 86754-08 for ; Fri, 13 Mar 2009 04:36:46 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail2.Synechron.com (mail2.synechron.com [220.225.40.41]) by mail.postgresql.org (Postfix) with ESMTP id 33D04633626 for ; Fri, 13 Mar 2009 04:36:41 -0300 (ADT) Received: from [10.31.15.20] [10.31.15.20] by mail2.Synechron.com with ESMTP (SMTPD-9.10) id AD30317BCC; Fri, 13 Mar 2009 13:07:20 +0530 Message-ID: <49BA0D03.3060005@synechron.com> Date: Fri, 13 Mar 2009 13:06:35 +0530 From: Ashish Karalkar User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: suresh gupta CC: pgsql-admin@postgresql.org Subject: Re: Query related References: <004001c9a3a9$9e715dc0$cd64290a@ind.zensar.com> In-Reply-To: <004001c9a3a9$9e715dc0$cd64290a@ind.zensar.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.477 tagged_above=0 required=5 tests=AWL=0.046, DNS_FROM_OPENWHOIS=2.431 X-Spam-Level: ** X-Archive-Number: 200903/158 X-Sequence-Number: 31658 suresh gupta wrote: > Hi Team, > > I had a table with 2 fields like First name(FN) and last name(LN). > When I give a query for the records of the 2 columns, they are > displaying in 2 different columns. My requirement is to combine both > the columns in a single one. As per my knowledge there are some > operators which combine 2 columns and display together in single > columns like |, +, etc. in other databases like Oracle. > For example FN = Suresh and LN=Gupta the output of the query should be > Suresh Gupta in single column. > > Is there any similar operator or method on postgresql to get my > result. Please advice. > > Pgsql version is 8.1 and window version software. > > > Regards, > *G. V. Suresh Gupta* > ------------------------------------------------------------------------ > *GTS - EMEIA, Zensar Technologies * > Zensar Knowledge Park, Plot#5, MIDC IT Tower, > Kharadi, Off Nagar Road, Pune - 411014 > Landline : +91-20-66453471 | +91-9890898688 > Email : suresh.g@zensar.com | website: > www.zensar.com > > DISCLAIMER: > This email may contain confidential or privileged information for the > intended recipient(s) and the views expressed in the same are not > necessarily the views of Zensar Technologies Ltd. If you are not the > intended recipient or have received this e-mail by error, its use is > strictly prohibited, please delete the e-mail and notify the sender. > Zensar Technologies Ltd. does not accept any liability for virus > infected mails. > This will help you. postgres=# create table name(fn text,ln text); CREATE TABLE postgres=# insert into name values ('abc','xyz'); INSERT 0 1 postgres=# select * from name; fn | ln -----+----- abc | xyz (1 row) postgres=# select fn||' '||ln as name from name; name --------- abc xyz (1 row) From suresh.g@zensar.com Fri Mar 13 07:43:37 2009 Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 6EB3E633EAB for ; Fri, 13 Mar 2009 04:43:37 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 87540-08 for ; Fri, 13 Mar 2009 04:43:30 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mailrelay.zensar.com (unknown [220.225.45.73]) by mail.postgresql.org (Postfix) with ESMTP id 792B0633C1B for ; Fri, 13 Mar 2009 04:43:31 -0300 (ADT) thread-index: Acmjr4IsO2Y39kH3Rv+sAFFSyhu5QQ== Received: from BRIDGEHEAD.ind.zensar.com ([10.42.2.95]) by mailrelay.zensar.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 13 Mar 2009 13:14:15 +0530 Received: from zenmailfe.ind.zensar.com ([10.42.2.88]) by BRIDGEHEAD.ind.zensar.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 13 Mar 2009 13:13:52 +0530 Received: from BATELCWDESK1094 ([10.41.100.205]) by zenmailfe.ind.zensar.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 13 Mar 2009 13:13:51 +0530 Content-Class: urn:content-classes:message Message-ID: <005401c9a3af$73bc14c0$cd64290a@ind.zensar.com> Importance: normal From: "suresh gupta" To: "Ashish Karalkar" Cc: References: <004001c9a3a9$9e715dc0$cd64290a@ind.zensar.com> <49BA0D03.3060005@synechron.com> Subject: Re: Query related Date: Fri, 13 Mar 2009 13:13:51 +0530 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: quoted-printable X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4133 X-OriginalArrivalTime: 13 Mar 2009 07:43:51.0511 (UTC) FILETIME=[73DB0E70:01C9A3AF] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.101 tagged_above=0 required=5 tests=AWL=0.001, RDNS_NONE=0.1 X-Spam-Level: X-Archive-Number: 200903/159 X-Sequence-Number: 31659 Thanks Ashish, it is working. Regards, G. V. Suresh Gupta -------------------------------------------------------------------------= ------- GTS - EMEIA, Zensar Technologies Zensar Knowledge Park, Plot#5, MIDC IT=20 Tower, Kharadi, Off Nagar Road, Pune - 411014 Landline : +91-20-66453471 = |=20 +91-9890898688 Email : suresh.g@zensar.com | website: www.zensar.com ----- Original Message -----=20 From: "Ashish Karalkar" To: "suresh gupta" Cc: Sent: Friday, March 13, 2009 1:06 PM Subject: Re: [ADMIN] Query related > suresh gupta wrote: >> Hi Team, >> I had a table with 2 fields like First name(FN) and last name(LN). = When=20 >> I give a query for the records of the 2 columns, they are displaying = in 2=20 >> different columns. My requirement is to combine both the columns in a = >> single one. As per my knowledge there are some operators which = combine 2=20 >> columns and display together in single columns like |, +, etc. in = other=20 >> databases like Oracle. >> For example FN =3D Suresh and LN=3DGupta the output of the query = should be=20 >> Suresh Gupta in single column. Is there any similar operator or = method on=20 >> postgresql to get my result. Please advice. >> Pgsql version is 8.1 and window version software. >> >> >> Regards, >> *G. V. Suresh Gupta* >> = ------------------------------------------------------------------------ >> *GTS - EMEIA, Zensar Technologies * >> Zensar Knowledge Park, Plot#5, MIDC IT Tower, >> Kharadi, Off Nagar Road, Pune - 411014 >> Landline : +91-20-66453471 | +91-9890898688 >> Email : suresh.g@zensar.com | website:=20 >> www.zensar.com >> >> DISCLAIMER: >> This email may contain confidential or privileged information for the = >> intended recipient(s) and the views expressed in the same are not=20 >> necessarily the views of Zensar Technologies Ltd. If you are not the=20 >> intended recipient or have received this e-mail by error, its use is=20 >> strictly prohibited, please delete the e-mail and notify the sender.=20 >> Zensar Technologies Ltd. does not accept any liability for virus = infected=20 >> mails. >> > This will help you. > > postgres=3D# create table name(fn text,ln text); > CREATE TABLE > postgres=3D# insert into name values ('abc','xyz'); > INSERT 0 1 > postgres=3D# select * from name; > fn | ln > -----+----- > abc | xyz > (1 row) > > postgres=3D# select fn||' '||ln as name from name; > name > --------- > abc xyz > (1 row) > > >=20 DISCLAIMER: This email may contain confidential or privileged information for the = intended recipient(s) and the views expressed in the same are not = necessarily the views of Zensar Technologies Ltd. If you are not the = intended recipient or have received this e-mail by error, its use is = strictly prohibited, please delete the e-mail and notify the sender. = Zensar Technologies Ltd. does not accept any liability for virus = infected mails.=20 From julius@nsoft.lt Fri Mar 13 07:53:07 2009 Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 607AD634669 for ; Fri, 13 Mar 2009 04:53:07 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 89692-04 for ; Fri, 13 Mar 2009 04:52:53 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from vilnius.balt.net (vilnius.balt.net [195.14.170.14]) by mail.postgresql.org (Postfix) with ESMTP id BA5BB632233 for ; Fri, 13 Mar 2009 04:52:56 -0300 (ADT) Received: from nSoft.lt (unknown [217.117.29.29]) by vilnius.balt.net (Postfix) with ESMTP id 558E53C4600; Fri, 13 Mar 2009 09:52:53 +0200 (EET) Received: from [192.168.16.104] (unknown [192.168.16.104]) by nSoft.lt (Postfix) with ESMTP id E839E12F054; Fri, 13 Mar 2009 13:13:38 +0000 (GMT) Message-ID: <49BA10D3.9070200@nsoft.lt> Date: Fri, 13 Mar 2009 09:52:51 +0200 From: Julius Tuskenis User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Ashish Karalkar CC: "pgsql-admin@postgresql.org" , suresh gupta Subject: Re: Query related References: <004001c9a3a9$9e715dc0$cd64290a@ind.zensar.com> <49BA0D03.3060005@synechron.com> In-Reply-To: <49BA0D03.3060005@synechron.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200903/160 X-Sequence-Number: 31660 Hello > postgres=# create table name(fn text,ln text); fn and ln could be nulls, so instead of > postgres=# select fn||' '||ln as name from name; SELECT COALESCE(fn,'')||' '||COALESCE(ln,'') from name should be used. This is because NULL||TEXT = NULL -- Julius Tuskenis Programavimo skyriaus vadovas UAB nSoft mob. +37068233050