| From: | Jan Ostrochovsky <ostrochovsky(at)mobiletech(dot)sk> |
|---|---|
| To: | dahd101+hm3ufk(at)guerrillamail(dot)com |
| Cc: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: Formatting query result like a calendar |
| Date: | 2014-04-04 14:43:52 |
| Message-ID: | 264572247.1712456.1396622632842.JavaMail.root@mobiletech.sk |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
Hi Jen,
what you need is called transposition - look for crosstab (part of tablefunc).
http://www.postgresql.org/docs/9.3/static/tablefunc.html
Jano Ostrochovsky
----- Original Message -----
From: dahd101+hm3ufk(at)guerrillamail(dot)com
To: pgsql-sql(at)postgresql(dot)org
Sent: Friday, April 4, 2014 2:34:07 PM
Subject: [SQL] Formatting query result like a calendar
Hi,
I have a query result that comes out as follows (this is an excerpt, the whole thing shows a whole month):
Date ID Day
31/03 1 Mon
01/04 0 Tue
02/04 1 Wed
03/04 1 Thu
04/04 0 Fri
07/04 1 Mon
08/04 0 Tue
09/04 1 Wed
10/04 1 Thu
11/04 0 Fri
I need it in the format:
Date Mon Tue Wed Thu Fri
31/03 1 0 1 1 0
07/04 1 0 1 1 0
Any ideas?
Thanks!
Jen
----
Sent using GuerrillMail.com
Block or report abuse: https://www.guerrillamail.com/abuse/?a=UUZnFAFNUKUZqB6742oYYBHUXMbe3cVX
--
Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Gerardo Herzig | 2014-04-08 11:53:41 | performance drop when function argument is evaluated in WHERE clause |
| Previous Message | dahd101+hm3ufk | 2014-04-04 12:34:07 | Formatting query result like a calendar |