From klodoma@ar-sd.net Fri Mar 12 14:36:20 2004 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 EBEB6D1D17D for ; Fri, 12 Mar 2004 14:36:20 +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 30130-07 for ; Fri, 12 Mar 2004 10:36:22 -0400 (AST) Received: from ar-sd.net (unknown [81.196.32.112]) by svr1.postgresql.org (Postfix) with ESMTP id E13E7D1CCD7 for ; Fri, 12 Mar 2004 10:36:17 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by ar-sd.net (Postfix) with ESMTP id 55B9220B1E for ; Fri, 12 Mar 2004 16:33:48 +0200 (EET) Received: from forge (unknown [192.168.0.11]) by ar-sd.net (Postfix) with SMTP id BC53F20AFA for ; Fri, 12 Mar 2004 16:33:47 +0200 (EET) Message-ID: <007e01c4083f$5fb78100$0b00a8c0@forge> From: "Andrei Bintintan" To: Subject: SQL query --- big question??? Date: Fri, 12 Mar 2004 16:36:14 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_007B_01C40850.22650C30" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2727.1300 X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.2 tagged_above=0.0 required=5.0 tests=BAYES_44, HTML_50_60, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200403/148 X-Sequence-Number: 17247 This is a multi-part message in MIME format. ------=_NextPart_000_007B_01C40850.22650C30 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi to all,=20 I have a big question. Can I write a query/function/agregate function (whatever) so that I can ret= urn the result of a query in a single line? I don't know if this is possibl= e to be made and please if it is not possible please say. I better give an example: table (id, name) 1 xxx 2 yyy 3 zzz Now I want to have a query like:=20 Select id from table=20 and the result to be something like: 1,2,3=20 and not 1 2 3 in different lines.=20 I just want to concatenate the results in a single result so this query res= ult will have 1 row and 1 column. This looks like an agregate function but = I don't know how to make this.=20 I hope you will understand what I want to do.=20 Please advise.=20 Thnx. Andy. ------=_NextPart_000_007B_01C40850.22650C30 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi to all,
 
I have a big question.
 
Can I write a query/function/agregate func= tion=20 (whatever) so that I can return the result of a query in a single line= ? I=20 don't know if this is possible to be made and please if it is not possible= =20 please say.
 
 
I better give an example:
 
table (id, name)
1 xxx
2 yyy
3 zzz
 
 
Now I want to have a query like:
 
Select id from table
 
and the result to be something like: 1,2,3= =20
and not 1 2 3 in different lines. <= /DIV>
 
I just want to concatenate the results in = a single=20 result so this query result will have 1 row and 1 column. This looks like a= n=20 agregate function but I don't know how to make this.
 
I hope you will understand what I want to = do.=20
 
Please advise.
 
Thnx.
 
Andy.
------=_NextPart_000_007B_01C40850.22650C30-- From dev@archonet.com Fri Mar 12 15:20:38 2004 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 B3925D1D168 for ; Fri, 12 Mar 2004 15:20:38 +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 52703-02 for ; Fri, 12 Mar 2004 11:20:40 -0400 (AST) Received: from anchor-post-37.mail.demon.net (anchor-post-36.mail.demon.net [194.217.242.86]) by svr1.postgresql.org (Postfix) with ESMTP id 741BFD1CCD7 for ; Fri, 12 Mar 2004 11:20:36 -0400 (AST) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-37.mail.demon.net with esmtp (Exim 3.35 #1) id 1B1oSk-000FoX-0b; Fri, 12 Mar 2004 15:20:40 +0000 Received: by mainbox.archonet.com (Postfix, from userid 529) id 8F32A1627B; Fri, 12 Mar 2004 15:20:19 +0000 (GMT) Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 609E315A83; Fri, 12 Mar 2004 15:20:17 +0000 (GMT) From: Richard Huxton To: "Andrei Bintintan" , Subject: Re: SQL query --- big question??? Date: Fri, 12 Mar 2004 15:20:19 +0000 User-Agent: KMail/1.5 References: <007e01c4083f$5fb78100$0b00a8c0@forge> In-Reply-To: <007e01c4083f$5fb78100$0b00a8c0@forge> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200403121520.19774.dev@archonet.com> X-Bogosity: No, tests=bogofilter, spamicity=0.000000, version=0.15.3 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/150 X-Sequence-Number: 17249 On Friday 12 March 2004 14:36, Andrei Bintintan wrote: > Hi to all, > > I have a big question. > > Can I write a query/function/agregate function (whatever) so that I can > return the result of a query in a single line? I don't know if this is > possible to be made and please if it is not possible please say. You're best doing this in the application really. However, if you only want to work with text, search the mailing list archives using keywords like: text concat aggregate and you should see an example solution where you build your own aggregate function. -- Richard Huxton Archonet Ltd