Re: [GENERAL] Crosstab function

2014-05-08 Thread Hengky Liwandouw
Thanks Sim, a very usefull information. From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Sim Zacks Sent: Wednesday, May 07, 2014 7:33 PM To: pgsql-general@postgresql.org Subject: Re: [GENERAL] Crosstab function What I have done in the

Re: [GENERAL] Crosstab function

2014-05-07 Thread Sim Zacks
G Johnston Sent: Tuesday, May 06, 2014 11:01 AM To: pgsql-general@postgresql.org Subject: Re: [GENERAL] Crosstab function Hengky Lie wrote Hi David, Are you sure that there is no pure sql solution for this ? I think (with my very limited postgres knowledge), function can solve this. Which

Re: [GENERAL] Crosstab function

2014-05-05 Thread Hengky Liwandouw
: pgsql-general@postgresql.org Subject: Re: [GENERAL] Crosstab function Hengky Lie wrote > Hi David, > > Are you sure that there is no pure sql solution for this ? > > I think (with my very limited postgres knowledge), function can solve > this. > > Which is the column header

Re: [GENERAL] Crosstab function

2014-05-05 Thread David G Johnston
Hengky Lie wrote > Hi David, > > Are you sure that there is no pure sql solution for this ? > > I think (with my very limited postgres knowledge), function can solve > this. > > Which is the column header I need but I really have no idea how to use > this > as column header. > > Anyway, If i c

Re: [GENERAL] Crosstab function

2014-05-05 Thread Dann Corbit
, 2014 7:49 PM To: Hengky Liwandouw Cc: pgsql-general General Subject: Re: [GENERAL] Crosstab function > Are you sure that there is no pure sql solution for this ? There is no pure SQL solution because a SQL query always gives a fixed number of columns. You could compose the SQL in your client

Re: [GENERAL] Crosstab function

2014-05-05 Thread Paul Jungwirth
n (Windev) and send the fixed sql to the server > > Thanks > > > > > -Original Message- > From: pgsql-general-ow...@postgresql.org > [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of David G Johnston > Sent: Monday, May 05, 2014 10:25 PM > To: pgsql

Re: [GENERAL] Crosstab function

2014-05-05 Thread Hengky Liwandouw
From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of David G Johnston Sent: Monday, May 05, 2014 10:25 PM To: pgsql-general@postgresql.org Subject: Re: [GENERAL] Crosstab function Hengky Lie wrote > The crosstab warehouse column name (OFFICE & St

Re: [GENERAL] Crosstab function

2014-05-05 Thread David G Johnston
Hengky Lie wrote > The crosstab warehouse column name (OFFICE & Store2) is taken from > tblwarehouse so when user add warehouse, crosstab column name will change > automatically. And also each row has total qty. In what programming language? The only way to do this is to dynamically construct the

[GENERAL] Crosstab function

2014-05-04 Thread Hengky Liwandouw
Hi Friends, Could somebody help me with crosstab function ? I have warehouse table: CREATE TABLE tblwarehouse ( id integer NOT NULL, warehousename character varying(20) ); COPY tblwarehouse (id, warehousename) FROM stdin; 2 OFFICE 3 STORE2 \. And product tabl

Re: [GENERAL] crosstab function

2010-12-14 Thread Sim Zacks
That did it.It's the smallest things that always kill you. Thanks Sim On 12/14/2010 05:00 PM, Filip Rembiałkowski wrote: http://www.postgresql.org/docs/8.4/interactive/tablefunc.html says: The |crosstab| function produces one output row for each consecutive group of input rows wit

Re: [GENERAL] crosstab function

2010-12-14 Thread Filip Rembiałkowski
http://www.postgresql.org/docs/8.4/interactive/tablefunc.html says: > The crosstab function produces one output row for each consecutive group > of input rows with the same row_name value. It fills the output valuecolumns, > left to right, with the > value fields from these rows. If there are fe

Re: [GENERAL] crosstab function

2010-12-14 Thread Sim Zacks
Just to clarify, there aren't duplicate rows. But if the customer purchased two products there are 2 rows for that customer, one with the quantity sum filled in for the first product and the second row with the quantity sum filled in for the second product. I want one customer row with all the

Re: [GENERAL] crosstab function

2010-12-14 Thread Sim Zacks
I rechecked and with products as columns it has duplicate customers. My goal is one row per customer with the sum of quantity filled in for each product they purchased. create table customers(customerid serial primary key, customername text); create table products(productid serial primary key,

Re: [GENERAL] crosstab function

2010-12-14 Thread Filip Rembiałkowski
please show - source data structures (in form of CREATE TABLE please) - actual whole query that creates duplicates 2010/12/14 Sim Zacks > postgres 8.2.17 > > I am trying out the crosstab function (tablefunc contrib) for reporting > needs and I'm having a problem. > I have customers and pro

[GENERAL] crosstab function

2010-12-13 Thread Sim Zacks
postgres 8.2.17 I am trying out the crosstab function (tablefunc contrib) for reporting needs and I'm having a problem. I have customers and products and the data is the quantity purchased. I am grouping by customername, productname in the source sql. My category sql depends if I want the prod

Re: [GENERAL] crosstab function - pivot - use column value as column description

2010-01-12 Thread Pavel Stehule
pardon, correct link http://okbob.blogspot.com/2008/08/using-cursors-for-generating-cross.html pavel 2010/1/13 Pavel Stehule : > Hello > > 2010/1/12 Daniel Schuchardt : >> Hy, >> >> i'm looking for a solution to get this table dynamicaly in that resultset: >> >> SELECT r_dbrid, r_kategorie AS c

Re: [GENERAL] crosstab function - pivot - use column value as column description

2010-01-12 Thread Pavel Stehule
Hello 2010/1/12 Daniel Schuchardt : > Hy, > > i'm looking for a solution to get this table dynamicaly in that resultset: > > SELECT r_dbrid, r_kategorie AS column_name, r_descr AS value FROM > recnokeyword WHERE r_dbrid=X >  r_dbrid  | r_kategorie |  r_descr > --+-+

Re: [GENERAL] crosstab function - pivot - use column value as column description

2010-01-12 Thread Daniel Schuchardt
See bottom. Am 12.01.2010 22:00, schrieb Merlin Moncure: On Tue, Jan 12, 2010 at 3:27 PM, Daniel Schuchardt wrote: Hy, i'm looking for a solution to get this table dynamicaly in that resultset: SELECT r_dbrid, r_kategorie AS column_name, r_descr AS value FROM recnokeyword WHERE r_dbrid=

Re: [GENERAL] crosstab function - pivot - use column value as column description

2010-01-12 Thread Merlin Moncure
On Tue, Jan 12, 2010 at 3:27 PM, Daniel Schuchardt wrote: > Hy, > > i'm looking for a solution to get this table dynamicaly in that resultset: > > SELECT r_dbrid, r_kategorie AS column_name, r_descr AS value FROM > recnokeyword WHERE r_dbrid=X >  r_dbrid  | r_kategorie |  r_descr > --+

[GENERAL] crosstab function - pivot - use column value as column description

2010-01-12 Thread Daniel Schuchardt
Hy, i'm looking for a solution to get this table dynamicaly in that resultset: SELECT r_dbrid, r_kategorie AS column_name, r_descr AS value FROM recnokeyword WHERE r_dbrid=X r_dbrid | r_kategorie | r_descr --+-+ 14725737 |material | Alu Sorte1 14725737 |far

[GENERAL] Crosstab function Problem

2003-09-03 Thread Kuldeep Tanna
Hi,     I am having problem using the crosstab function ( which is under the contrib/tablefunc directory). I have installed the tablefunc module and also installed the functions into my DB. I am using postgresql 7.4 beta version.   I am issuing the following query,   select *from crosstab('s