Hello all ,
I have a similar situation - an EAV table.
entity_attr_id integer
entity_id bigint
ent_attr_value character varying
I am trying
select * from crosstab('select entity_id::text as row_name,
entity_attr_id::bigint as entity_attr_id , ent_attr_value::text as
2012/3/12 John Fabiani :
> select *
> from crosstab('select item_number::text, week_of::date, planned_demand::text
> from holding_table order by 1,2')
> as ct(row_name text, week_of date, planned text)
>
> The above does not work. What am I doing wrong?
what it does?
do you have tablefunc exten
select *
from crosstab('select item_number::text, week_of::date, planned_demand::text
from holding_table order by 1,2')
as ct(row_name text, week_of date, planned text)
The above does not work. What am I doing wrong?
Johnf
On Monday, March 12, 2012 06:01:21 PM Pavel Stehule wrote:
> Hello
>
>
Hello
maybe this article helps
http://stackoverflow.com/questions/3002499/postgresql-crosstab-query
there are more ways
Regards
Pavel Stehule
2012/3/12 John Fabiani :
> Hi,
> I don't know if it because I'm as sick as dog or I'm just a plain idiot - most
> likely a little of both.
>
> Here is
sprüngliche Nachricht-
> Von: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org]
> Im Auftrag von John Fabiani Gesendet: Freitag, 24. Februar 2012 09:39
> An: pgsql-sql@postgresql.org
> Betreff: Re: [SQL] crosstab help
>
> That worked! However, I need the actual
Gesendet: Freitag, 24. Februar 2012 09:39
An: pgsql-sql@postgresql.org
Betreff: Re: [SQL] crosstab help
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
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
On Mon, Feb 1, 2010 at 3:11 PM, Adam Sherman wrote:
> Actually, the query I was running is:
>
> SELECT
>cust_id as customer,
>date_trunc(''day'', date) AS day,
> SUM(billed_duration)/60.0::numeric(10,4) AS minutes
>
> billed_duration is an integer. Make sense?
>
> If billed_duration i
On 2010-02-01, at 14:22 , Lee Hachadoorian wrote:
> The output column data type (day1, day2, etc.) is supposed to match the value
> data type. I used numeric(10,4) because that's what your original post
> specified, but the billed_duration column in your most recent post looks like
> it might be
The output column data type (day1, day2, etc.) is supposed to match the
value data type. I used numeric(10,4) because that's what your original post
specified, but the billed_duration column in your most recent post looks
like it might be integer? (Or is it defined as numeric(10,4), but you never
e
On 2010-02-01, at 11:34 , Lee Hachadoorian wrote:
> You basically have three parts:
>
> 1) SELECT query in the form (row header, column header, cell value). In this
> case it is an aggregate query so that you can sum the transactions over a
> given day.
>
> 2) List of column headers. If you wa
I'm flying blind here since I have nothing that looks like the structure you
described to experiment on, but based on some crosstabs I have set up this
should get you started. Explanatory notes follow.
SELECT pivot.*
FROM crosstab('
--row header, column header, cell value
SELECT customer_i
"Chris Preston" <[EMAIL PROTECTED]> writes:
> I am almost a newbie to postgres and only recently found out about one of
> the greatest function crosstab in postgres. The problem is that I am using
> 8.1 and when I run the function I am getting an error relating to
> $libdir/tablefunc.. someone
"ronald tabada" <[EMAIL PROTECTED]> writes:
> ... when I tried
> producing reports with more than 17 columns it displayed the following
> error message:
> ERROR: invalid return type
> SQL state: 42601
> Detail: Query-specified return tuple has 39 columns but crosstab returns 17.
Worksforme. Mayb
On Sun, Oct 22, 2006 at 01:57:09PM +0200, Leendert Paul Diterwich wrote:
> The problem is that the data is being shifted when there is no
> price for Supplier1 for product 3:
>
> Productnumber Supplier1 Supplier2
> 2 0.80.9
> 3
bandeng wrote:
hello guys,
I want to use crosstab function but that function it doesnt exist. my
version is 7.3 so how do i get the tablefunc.sql from postgre contrib?
i saw in ver 8 win32 is checkable.
Is it not in the contrib/ directory? Or did you install from a package
of some sort (and if so,
THeo,
> I have tried using unions or subselects however the table is quite large
> and it takes far too long to run. The most efficient way would be to create
> a stored proc that uses a cursor to loop through the table transforming the
> data into the new table structure. However I would apprecia
Adam Witney wrote:
The missing values seemed to have been ignored and so the data is being
shifted to the left and so put in the wrong columns.
Am I using this function correctly? What is supposed to happen with missing
values?
Yeah, that's a limitation of the version of crosstab distributed with
> Richard,
>
>> I have a table containing milestones achieved for projects, marked as
>> being in particular quarters.
>>
>> CREATE TABLE milestones (
>> proj_id int4,
>> sortorder SERIAL,
>> qtr int4,
>> description varchar(200)
>> );
>>
>> Now I need the milestone de
Richard,
> I have a table containing milestones achieved for projects, marked as
> being in particular quarters.
>
> CREATE TABLE milestones (
> proj_id int4,
> sortorder SERIAL,
> qtr int4,
> description varchar(200)
> );
>
> Now I need the milestone descriptions o
21 matches
Mail list logo