pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Osvaldo Kussama <osvaldo.kussama@gmail.com>
To: James Kitambara <jameskitambara@yahoo.co.uk>
Cc: gibsosmat@gmail.com
Cc: pgsql-sql@postgresql.org
Subject: Re: Bucketing Row Data in columns
Date: Thu, 25 Jun 2009 14:37:49 -0300
Message-ID: <690707f60906251037h6d5dd0d5g333a981fef03e38f@mail.gmail.com> (raw)
In-Reply-To: <863824.473.qm@web27906.mail.ukl.yahoo.com>
References: <863824.473.qm@web27906.mail.ukl.yahoo.com>

2009/6/25 James Kitambara <jameskitambara@yahoo.co.uk>:
>
> Hello Mr. Sandeep Bandela,
>
> I have gone through your scenario and come up with the following solution.
>
> SELECT USER_ID, CREATE_TIMESTAMP::DATE, SUM(AMOUNT)
> FROM ORDERS
> GROUP BY USER_ID, CREATE_TIMESTAMP
> ORDER BY USER_ID, CREATE_TIMESTAMP;
>
> Maybe you need to do little modification on the query to get what you want.
>


Contrib tablefunc/crosstab function may help you.
http://www.postgresql.org/docs/current/interactive/tablefunc.html

Osvaldo



view thread (7+ messages)  latest in thread

Message-ID: <690707f60906251037h6d5dd0d5g333a981fef03e38f@mail.gmail.com>
Permalink:  ../690707f60906251037h6d5dd0d5g333a981fef03e38f@mail.gmail.com/
Also on:    postgresql.org/message-id/690707f60906251037h6d5dd0d5g333a981fef03e38f@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: osvaldo.kussama@gmail.com, jameskitambara@yahoo.co.uk, gibsosmat@gmail.com
  Subject: Re: Bucketing Row Data in columns
  In-Reply-To: <690707f60906251037h6d5dd0d5g333a981fef03e38f@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