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

2008-11-14 Thread Scott Marlowe
On Wed, Nov 12, 2008 at 3:59 AM, zxo102 ouyang <[EMAIL PROTECTED]> wrote: > Hi everyone, > My data with same timestamp "2008-11-12 12:12:12" in postgresql are as > follows > > rowid data unitchannel create_on > ---

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

2008-11-14 Thread Joshua Tolley
On Thu, Nov 13, 2008 at 06:39:47PM -0800, Eus wrote: > Isn't that something like this is better handled at the application level > instead of the DB level? > > IOW, isn't that the cost of doing the query above far more expensive than > doing a little coding at the application level? That's some

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

2008-11-13 Thread Eus
Hi Ho! --- On Thu, 11/13/08, Brent Wood <[EMAIL PROTECTED]> wrote: > You need to use a self relation, not a group by, as no data > are being aggregated into a new single value, which is what > the group by achieves. > > This joins a table to itself, so that columns in it can be > replicated. The

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

2008-11-12 Thread Sam Mason
On Thu, Nov 13, 2008 at 06:56:43AM +1300, Brent Wood wrote: > You need to use a self relation, not a group by, as no data are > being aggregated into a new single value, which is what the group by > achieves. It's perfectly possible to use a GROUP BY clause; all rows from one time period want to b

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

2008-11-12 Thread Brent Wood
You need to use a self relation, not a group by, as no data are being aggregated into a new single value, which is what the group by achieves. This joins a table to itself, so that columns in it can be replicated. The key is that the where clause in each case needs to just select one channel, so

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

2008-11-12 Thread Craig Ringer
zxo102 ouyang wrote: > I would like to "group" them into one line with SQL like > >1.5 MPa 2.5M3 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 trunca

[GENERAL] how to "group" several records with same timestamp into one line?

2008-11-12 Thread zxo102 ouyang
Hi everyone, My data with same timestamp "2008-11-12 12:12:12" in postgresql are as follows rowid data unitchannel create_on -- 11.5 MPa channel1 2008-11-12 12:12:12 2