Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 4926E2E336E for ; Wed, 5 Dec 2007 06:47:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 84028-09 for ; Wed, 5 Dec 2007 06:47:48 -0400 (AST) Received: from n7.bullet.re3.yahoo.com (n7.bullet.re3.yahoo.com [68.142.237.92]) by postgresql.org (Postfix) with SMTP id 0E7742E0064 for ; Wed, 5 Dec 2007 06:47:47 -0400 (AST) Received: from [68.142.237.89] by n7.bullet.re3.yahoo.com with NNFMP; 05 Dec 2007 10:47:46 -0000 Received: from [66.196.101.131] by t5.bullet.re3.yahoo.com with NNFMP; 05 Dec 2007 10:47:46 -0000 Received: from [127.0.0.1] by rrr2.mail.re1.yahoo.com with NNFMP; 05 Dec 2007 10:47:46 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 896193.35987.bm@rrr2.mail.re1.yahoo.com Received: (qmail 2500 invoked by uid 60001); 5 Dec 2007 10:47:45 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=X-YMail-OSG:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=dcUd5b7j8Czb3P+Ad3T2+TA73sdfDyOI/ql+KrYnWLPce8qZB27DbGbVdO5XKsW8il1tKSHqLUASpV05QKn+rIykHzhA+EXBoSQ699V3fqd8QrJSoBQJIGcn7Vr8Cs4N22/YnGbJoY27zQwkv8/6W8GZYqMjjXrqlBMOShpgaWg=; X-YMail-OSG: a1PfWbMVM1nSngXPgiuGRD.kOJGuFweB4JuSj28B9Y5eWORQ4gywBmtSUXieem7h0mSgd1.3nr_O3KpXQCdz87jrTXrUnsgxRKQk Received: from [59.163.11.66] by web94314.mail.in2.yahoo.com via HTTP; Wed, 05 Dec 2007 10:47:44 GMT Date: Wed, 5 Dec 2007 10:47:44 +0000 (GMT) From: Ashish Karalkar Subject: Re: SQL Query To: "A. Kretschmer" , pgsql-general@postgresql.org In-Reply-To: <20071205103548.GD24799@a-kretschmer.de> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1693396904-1196851664=:2408" Content-Transfer-Encoding: 8bit Message-ID: <33481.2408.qm@web94314.mail.in2.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/243 X-Sequence-Number: 124987 --0-1693396904-1196851664=:2408 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit "A. Kretschmer" wrote: am Wed, dem 05.12.2007, um 10:24:04 +0000 mailte Ashish Karalkar folgendes: > Hello List member, > > Iha a table containing two columns x and y . for single value of x there are > multiple values in y e.g > > X Y > ------------ > 1 ABC > 2 PQR > 3 XYZ > 4 LMN > 1 LMN > 2 XYZ > > I want a query that will give me following output > > 1 ABC:LMN > 2 PQR:XYZ > 3 XYZ > 4 LMN > > Any help will be really helpful You need a new aggregate-function. A solution for a similar problem (but with comma instead :) can you find here: http://www.zigo.dhs.org/postgresql/#comma_aggregate Thanks Andreas for your replay. But i don't have an option two send argument to the store proc nither do i know how many multiple records are there for a single X. I want result for all rows of table. I dont thnink that function will give desired output. any suggestions? With Regards Ashish Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org/ --------------------------------- Save all your chat conversations. Find them online. --0-1693396904-1196851664=:2408 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit

"A. Kretschmer" <andreas.kretschmer@schollglas.com> wrote:
am Wed, dem 05.12.2007, um 10:24:04 +0000 mailte Ashish Karalkar folgendes:
> Hello List member,
>
> Iha a table containing two columns x and y . for single value of x there are
> multiple values in y e.g
>
> X Y
> ------------
> 1 ABC
> 2 PQR
> 3 XYZ
> 4 LMN
> 1 LMN
> 2 XYZ
>
> I want a query that will give me following output
>
> 1 ABC:LMN
> 2 PQR:XYZ
> 3 XYZ
> 4 LMN
>
> Any help will be really helpful

You need a new aggregate-function. A solution for a similar problem (but
with comma instead :) can you find here:
http://www.zigo.dhs.org/postgresql/#comma_aggregate

Thanks Andreas for your replay.
But i don't have an option two send argument to the store proc nither do i know how many multiple records are there for a single X. I want result for all rows of table.

I dont thnink that function will give desired output.

any suggestions?

With Regards
Ashish






Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org/


Save all your chat conversations. Find them online. --0-1693396904-1196851664=:2408--