pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sumeet <asumeet@gmail.com>
To: MHahn@seeandswim.com <MHahn@seeandswim.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: All columns from table in a joined query
Date: Wed, 23 Aug 2006 15:44:35 -0400
Message-ID: <7539aebb0608231244n142bb3b4o97f82cb76a4e22ed@mail.gmail.com> (raw)
In-Reply-To: <14106936.1156360501724.JavaMail.teamon@b217.teamon.com>
References: <14106936.1156360501724.JavaMail.teamon@b217.teamon.com>

You need to create a custom aggregate for this

CREATE AGGREGATE array_accum (

    sfunc = array_append,

    basetype = anyelement,

    stype = anyarray,

    initcond = '{}'

);


 then use the field names in your query like this


 select array_to_string(array_accum(field1 || '@' || field2),'#') as
field_alias from table_name

records will be seperated by '#'

hope this helps.





On 8/23/06, MHahn@seeandswim.com <MHahn@seeandswim.com> wrote:
>
> I've been trying to figure out how to do the following:
>
> Select schedule.* from schedule join meetingday on schedule.id =
> meetingday.scheduleid where sessionnumber = 165 group by schedule.* order
> by min(meetingday.date);
>
> Is this possible in any way, or do I need to list each field of the
> schedule table to get all of them?
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>



-- 
Thanks,
Sumeet Ambre
Masters of Information Science Candidate,
Indiana University.

On 8/23/06, MHahn@seeandswim.com <MHahn@seeandswim.com> wrote:
>
> I've been trying to figure out how to do the following:
>
> Select schedule.* from schedule join meetingday on schedule.id =
> meetingday.scheduleid where sessionnumber = 165 group by schedule.* order
> by min(meetingday.date);
>
> Is this possible in any way, or do I need to list each field of the
> schedule table to get all of them?
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>



-- 
Thanks,
Sumeet Ambre
Masters of Information Science Candidate,
Indiana University.

view thread (3+ messages)  latest in thread

Message-ID: <7539aebb0608231244n142bb3b4o97f82cb76a4e22ed@mail.gmail.com>
Permalink:  ../7539aebb0608231244n142bb3b4o97f82cb76a4e22ed@mail.gmail.com/
Also on:    postgresql.org/message-id/7539aebb0608231244n142bb3b4o97f82cb76a4e22ed@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: asumeet@gmail.com, MHahn@seeandswim.com
  Subject: Re: All columns from table in a joined query
  In-Reply-To: <7539aebb0608231244n142bb3b4o97f82cb76a4e22ed@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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