Re: how to "group" several records with same timestamp into one line?

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "zxo102 ouyang" <zxo102(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: how to "group" several records with same timestamp into one line?
Date: 2008-11-14 14:29:42
Message-ID: dcc563d10811140629u62718f02w42fde5176e84f770@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Nov 12, 2008 at 3:59 AM, zxo102 ouyang <zxo102(at)gmail(dot)com> wrote:
> Hi everyone,
> My data with same timestamp "2008-11-12 12:12:12" in postgresql are as
> follows
>
> rowid data unit channel create_on
> ------------------------------------------------------------------------------
> 1 1.5 MPa channel1 2008-11-12 12:12:12
> 2 2.5 M3 channel2 2008-11-12 12:12:12
> 3 3.5 M3 channel3 2008-11-12 12:12:12
> 4 4.5 t channel4 2008-11-12 12:12:12
> ------------------------------------------------------------------------------
>
> I would like to "group" them into one line with SQL like
>
> 1.5 MPa 2.5 M3 3.5 M3 4.5 t 2008-11-12 12:12:12
>

Lookup the crosstab contrib functions.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dan Armbrust 2008-11-14 14:45:46 Re: vacuum output question
Previous Message Serge Fonville 2008-11-14 13:55:04 Re: [JDBC] Re : [pgadmin-support] trouble in installing postgreSQL 8.3