agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
Crosstab function
10+ messages / 6 participants
[nested] [flat]

* Crosstab function
@ 2005-04-06 06:55  bandeng <postgredb@gmail.com>
  0 siblings, 2 replies; 10+ messages in thread

From: bandeng @ 2005-04-06 06:55 UTC (permalink / raw)
  To: pgsql-sql

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.

Thanks
Ricky

-- 
Gutten Aben Sugeng Sonten, Jangane Kurang Santen
bandeng....................



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Crosstab function
@ 2005-04-06 08:25  Richard Huxton <dev@archonet.com>
  parent: bandeng <postgredb@gmail.com>
  1 sibling, 0 replies; 10+ messages in thread

From: Richard Huxton @ 2005-04-06 08:25 UTC (permalink / raw)
  To: bandeng <postgredb@gmail.com>; +Cc: pgsql-sql

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, what sort).

-- 
   Richard Huxton
   Archonet Ltd



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: [despammed] Crosstab function
@ 2005-04-06 08:32  Andreas Kretschmer <akretschmer@despammed.com>
  parent: bandeng <postgredb@gmail.com>
  1 sibling, 1 reply; 10+ messages in thread

From: Andreas Kretschmer @ 2005-04-06 08:32 UTC (permalink / raw)
  To: pgsql-sql

am  06.04.2005, um 13:55:35 +0700 mailte bandeng folgendes:
> 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?

apt-get install postgresql-contrib


Regards, Andreas
-- 
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47212,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    === 



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: [despammed] Crosstab function
@ 2005-04-07 09:46  bandeng <postgredb@gmail.com>
  parent: Andreas Kretschmer <akretschmer@despammed.com>
  0 siblings, 1 reply; 10+ messages in thread

From: bandeng @ 2005-04-07 09:46 UTC (permalink / raw)
  To: pgsql-sql

I have install postgresql-contrib finally... i'm newbie in server.
I use freebsd 4.8, I saw in documentation it is said use tablefunc.sql
but in freebsd i found file tablefunc.so , it is already compiled. is
there suggestion to install tablefunc.so ?

Thank you
Ricky

On Apr 6, 2005 3:32 PM, Andreas Kretschmer <akretschmer@despammed.com> wrote:
> am  06.04.2005, um 13:55:35 +0700 mailte bandeng folgendes:
> > 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?
> 
> apt-get install postgresql-contrib
> 
> Regards, Andreas
> --
> Andreas Kretschmer    (Kontakt: siehe Header)
> Heynitz:  035242/47212,      D1: 0160/7141639
> GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
> ===    Schollglas Unternehmensgruppe    ===
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
> 


-- 
Gutten Aben Sugeng Sonten, Jangane Kurang Santen
bandeng....................



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: [despammed] Crosstab function
@ 2005-04-07 11:36  Markus Schaber <schabi@logix-tt.com>
  parent: bandeng <postgredb@gmail.com>
  0 siblings, 0 replies; 10+ messages in thread

From: Markus Schaber @ 2005-04-07 11:36 UTC (permalink / raw)
  To: bandeng <postgredb@gmail.com>; +Cc: pgsql-sql

Hi, Bandeng,

bandeng schrieb:
> I have install postgresql-contrib finally... i'm newbie in server.
> I use freebsd 4.8, I saw in documentation it is said use tablefunc.sql
> but in freebsd i found file tablefunc.so , it is already compiled. is
> there suggestion to install tablefunc.so ?

I think you misunderstood the relationship between tablefunc.so and
tablefunc.sql, as the former one is not the compiled form of the latter one.

The .sql file contains the statements that create functions, datatypes,
aggregates etc. For functions programmed in C,  SQL function definitions
eference the .so file and the function symbol name therein so postgresql
can load the library and jump into the C code functions, but the SQL
files could also define functions by including their source (for
languages such as plpgsql).

So to "install" the .so file, you have use psql -f tablefunc.sql yourdb.

Markus

Attachments:

  [application/pgp-signature] signature.asc (255B, ../../42551B57.30208@logix-tt.com/2-signature.asc)
  download

^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Crosstab function
@ 2017-04-02 16:05  Gowtham Vel <c8gowthamvel@gmail.com>
  0 siblings, 1 reply; 10+ messages in thread

From: Gowtham Vel @ 2017-04-02 16:05 UTC (permalink / raw)
  To: pgsql-sql

 Hi postgresql support,

Could you please help on crosstab function for dynamic column.

Regards,
Gowtham K


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Crosstab function
@ 2017-04-03 14:39  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Gowtham Vel <c8gowthamvel@gmail.com>
  0 siblings, 1 reply; 10+ messages in thread

From: Adrian Klaver @ 2017-04-03 14:39 UTC (permalink / raw)
  To: Gowtham Vel <c8gowthamvel@gmail.com>; pgsql-sql

On 04/02/2017 09:05 AM, Gowtham Vel wrote:
>  Hi postgresql support,
>
> Could you please help on crosstab function for dynamic column.

The docs and an example:

https://www.postgresql.org/docs/9.6/static/tablefunc.html

http://stackoverflow.com/questions/3002499/postgresql-crosstab-query

If you need something more specific, then we will need to see an example 
of what you are trying to achieve.

>
> Regards,
> Gowtham K
>
>


-- 
Adrian Klaver
adrian.klaver@aklaver.com


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Crosstab function
@ 2017-04-04 18:28  Gowtham Vel <c8gowthamvel@gmail.com>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 1 reply; 10+ messages in thread

From: Gowtham Vel @ 2017-04-04 18:28 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-sql

Hi Adrian,

I have attached the input table and output table in below .xlsx sheet

1) I have removed the duplicate rows and sort the INPUT_TABLE  i.e.,
SELECT * FROM "public".INPUT_TABLE ORDER by 2,3
2) Input_table column name should be the column heading for Output_table.
3) Input_table column value should be the rows for Output_table.
4) some values i have mention in null , because its for future
record(its might come)
5) please refer the below attached sheet and provide your assistance,

Regards,
Gowtham K

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Attachments:

  [application/vnd.openxmlformats-officedocument.spreadsheetml.sheet] Example for Input and Output Table .xlsx (13.4K, ../../CAH-J9gYKOH+WFHYYVw7YsrkU3YZ8GMFYaUnjEe-FwXxvkFFEDg@mail.gmail.com/2-Example%20for%20Input%20and%20Output%20Table%20.xlsx)
  download

^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Crosstab function
@ 2017-04-05 17:04  Gowtham Vel <c8gowthamvel@gmail.com>
  parent: Gowtham Vel <c8gowthamvel@gmail.com>
  0 siblings, 1 reply; 10+ messages in thread

From: Gowtham Vel @ 2017-04-05 17:04 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-sql

Hi Adrian,

Could you please check and update on my below email

Thanks
Gowtham K


On Apr 4, 2017 11:58 PM, "Gowtham Vel" <c8gowthamvel@gmail.com> wrote:

> Hi Adrian,
>
> I have attached the input table and output table in below .xlsx sheet
>
> 1) I have removed the duplicate rows and sort the INPUT_TABLE  i.e.,
> SELECT * FROM "public".INPUT_TABLE ORDER by 2,3
> 2) Input_table column name should be the column heading for Output_table.
> 3) Input_table column value should be the rows for Output_table.
> 4) some values i have mention in null , because its for future
> record(its might come)
> 5) please refer the below attached sheet and provide your assistance,
>
> Regards,
> Gowtham K
>

^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Crosstab function
@ 2017-04-06 00:01  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Gowtham Vel <c8gowthamvel@gmail.com>
  0 siblings, 0 replies; 10+ messages in thread

From: Adrian Klaver @ 2017-04-06 00:01 UTC (permalink / raw)
  To: Gowtham Vel <c8gowthamvel@gmail.com>; +Cc: pgsql-sql

On 04/05/2017 10:04 AM, Gowtham Vel wrote:
> Hi Adrian,
>
> Could you please check and update on my below email

This would have happened sooner with a self contained test case e.g. a 
CREATE TABLE statement and COPY/INSERT statements for the data.

At any rate:

test=# \d crosstab_test
       Table "public.crosstab_test"
  Column |       Type        | Modifiers
--------+-------------------+-----------
  id     | integer           |
  wf_id  | character varying |
  name   | character varying |
  value  | character varying |

I lower cased the name values in the above.

Showing a small subset of the 80 some names you have:

SELECT
     *
FROM
     crosstab ('select wf_id, name, value from crosstab_test where name 
in(''interchangecontrolnumber'', ''ponumber'', ''docid'',''direction'', 
''docdate'') order by 1',
'select distinct name from crosstab_test where name 
in(''interchangecontrolnumber'', ''ponumber'', ''docid'', ''direction'', 
''docdate'') order by 1')
AS
	(
	wf_id INT,
         direction VARCHAR,
         docdate VARCHAR,
         docid VARCHAR,
         interchange VARCHAR,
         po VARCHAR);


-[ RECORD 1 ]----------------------
wf_id       | 1627075
direction   | Inbound
docdate     | 20170316
docid       | 411069802
interchange | 2947
po          | 411069802
-[ RECORD 2 ]----------------------
wf_id       | 1652040
direction   | Outbound
docdate     | 20170319
docid       | 201703191489929516706
interchange | 7167
po          | NULL


For more information see:

https://www.postgresql.org/docs/9.5/static/tablefunc.html

F.36.1.4. crosstab(text, text)

>
> Thanks
> Gowtham K
>
>
> On Apr 4, 2017 11:58 PM, "Gowtham Vel" <c8gowthamvel@gmail.com
> <mailto:c8gowthamvel@gmail.com>> wrote:
>
>     Hi Adrian,
>
>     I have attached the input table and output table in below .xlsx sheet
>
>     1) I have removed the duplicate rows and sort the INPUT_TABLE  i.e.,
>     SELECT * FROM "public".INPUT_TABLE ORDER by 2,3
>     2) Input_table column name should be the column heading for
>     Output_table.
>     3) Input_table column value should be the rows for Output_table.
>     4) some values i have mention in null , because its for future
>     record(its might come)
>     5) please refer the below attached sheet and provide your assistance,
>
>     Regards,
>     Gowtham K
>


-- 
Adrian Klaver
adrian.klaver@aklaver.com


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



^ permalink  raw  reply  [nested|flat] 10+ messages in thread


end of thread, other threads:[~2017-04-06 00:01 UTC | newest]

Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-04-06 06:55 Crosstab function bandeng <postgredb@gmail.com>
2005-04-06 08:25 ` Richard Huxton <dev@archonet.com>
2005-04-06 08:32 ` Andreas Kretschmer <akretschmer@despammed.com>
2005-04-07 09:46   ` bandeng <postgredb@gmail.com>
2005-04-07 11:36     ` Markus Schaber <schabi@logix-tt.com>
2017-04-02 16:05 Crosstab function Gowtham Vel <c8gowthamvel@gmail.com>
2017-04-03 14:39 ` Adrian Klaver <adrian.klaver@aklaver.com>
2017-04-04 18:28   ` Gowtham Vel <c8gowthamvel@gmail.com>
2017-04-05 17:04     ` Gowtham Vel <c8gowthamvel@gmail.com>
2017-04-06 00:01       ` Adrian Klaver <adrian.klaver@aklaver.com>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox