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

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
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-12 11:36:19
Message-ID: 491ABFB3.8090809@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

zxo102 ouyang wrote:

> 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

Look up the "GROUP BY" clause.

http://www.postgresql.org/docs/current/static/sql-select.html

Note that with timestamps you may have to truncate/round them to the
desired precision, since current versions of PostgreSQL store timestamps
in a floating point format and two timestamps you'd expect to be equal
may not end up being seen as exactly equal.

--
Craig Ringer

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Teodor Sigaev 2008-11-12 14:31:06 Re: still gin index creation takes forever
Previous Message A. Kretschmer 2008-11-12 11:24:39 Re: how to several records with same timestamp into one line?