Hi Folks,
I have one that I need your advise on how to construct.
I have the need to create a series of dates starting from a Sunday - one week
apart.
(select ((date_trunc('week', '2012-02-12'::date)::date) +(i+6)) as week_date
from
generate_series(0,84,7) i) as foo
that gives a table of sun
Thanks for the insight!
johnf
On Friday, February 24, 2012 09:48:03 AM Andreas Gaab wrote:
> As far as I know you must define the numbers (and types) of columns and
> column headers individually for each query or define some custom
> function...
>
> Andreas
>
> -Ursprüngliche Nachricht-
>
As far as I know you must define the numbers (and types) of columns and column
headers individually for each query or define some custom function...
Andreas
-Ursprüngliche Nachricht-
Von: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] Im
Auftrag von John Fabiani
That worked! However, I need the actual date to be the column heading? And
of course the dates change depending on the date passed to the function:
xchromasun._chromasun_totals(now()::date)
So how do I get the actual dates as the column header?
johnf
On Friday, February 24, 2012 09:27:38 AM An
Hi,
the return type of the crosstab must be defined correctly, according to the
number of expected columns.
Try following (untested):
select * from crosstab(
'select item_number::text as row_name, to_char(week_of,''MM-DD-YY'')::date as
bucket, planned_qoh::integer as buckvalue from
xchromasun
I have a simple table
item_number week_of planned_qoh
-- -- --
5 2012-02-05 30
5 2012-02-12 40
5 2012-02-19 50
where
item_number text
week_of date
planned