List:Replication« Previous MessageNext Message »
From:m.weiss Date:January 26 2005 6:13pm
Subject:Transpose mysql4
View as plain text  
Hi i've search many rsrc about transpose pivot like excel or acces

i would like to transpose my table(matrix) by sql
and replicate the transpose function but 
mysql4 doesn't know create function

#TABLE PROPERTIES OF ONE ENTITY
(P1 TYPE)
(P2 STATE UPDATED ...)
(P3 ENTITY ID)
(P4 PROPERTY ID)
(P5 PROPERTY LIB)

P1 P2 P3 P4 P5
---------------------------
P  U  04 p01 "a city"
P  X  04 p02 "an addrs"
P  X  04 p03 "a zipcode"
P  U  04 p04 "a tel"

P  U  05 p01 "a city"
P  X  05 p02 "an addrs"
P  X  05 p03 "a zipcode"
P  U  05 p04 "a tel"

ect

i would like to pivot ON P3

# TABLE ENTITY
id(P3) city(P5->p01) addr(P5->p02) zipcode(P5->p03) tel(P5->p04)
-----------------------------
04 "a city" "an addrs" "a zipcode" "a tel"
05 "a city" "an addrs" "a zipcode" "a tel"

i've tried to inner join and select with num row of an ID
but no way 

if someone has already replicated this (i do sure that yes :) )

sorry but i'm not an sql KILLER 
i could do this by select all and put my result into an array
and tranpose my array but if i could do this in one sql process

Regards





Thread
Transpose mysql4m.weiss26 Jan