pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
SQL query --- big question???
2+ messages / 2 participants
[nested] [flat]

* SQL query --- big question???
@ 2004-03-12 14:36  Andrei Bintintan <klodoma@ar-sd.net>
  0 siblings, 1 reply; 2+ messages in thread

From: Andrei Bintintan @ 2004-03-12 14:36 UTC (permalink / raw)
  To: pgsql-sql

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.


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 
and not 1 2 3 in different lines. 

I just want to concatenate the results in a single result so this query result will have 1 row and 1 column. This looks like an agregate function but I don't know how to make this. 

I hope you will understand what I want to do. 

Please advise. 

Thnx.

Andy.

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: SQL query --- big question???
@ 2004-03-12 15:20  Richard Huxton <dev@archonet.com>
  parent: Andrei Bintintan <klodoma@ar-sd.net>
  0 siblings, 0 replies; 2+ messages in thread

From: Richard Huxton @ 2004-03-12 15:20 UTC (permalink / raw)
  To: Andrei Bintintan <klodoma@ar-sd.net>; pgsql-sql

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2004-03-12 15:20 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-03-12 14:36 SQL query --- big question??? Andrei Bintintan <klodoma@ar-sd.net>
2004-03-12 15:20 ` Richard Huxton <dev@archonet.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox