Re: Bucketing Row Data in columns

From: Osvaldo Kussama <osvaldo(dot)kussama(at)gmail(dot)com>
To: James Kitambara <jameskitambara(at)yahoo(dot)co(dot)uk>
Cc: gibsosmat(at)gmail(dot)com, pgsql-sql(at)postgresql(dot)org
Subject: Re: Bucketing Row Data in columns
Date: 2009-06-25 17:37:49
Message-ID: 690707f60906251037h6d5dd0d5g333a981fef03e38f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

2009/6/25 James Kitambara <jameskitambara(at)yahoo(dot)co(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message bricklen 2009-06-25 20:02:31 Re: Bucketing Row Data in columns
Previous Message Oliveiros Cristina 2009-06-25 16:13:42 Re: Bucketing Row Data in columns