MySQL Forums
Forum List  »  Stored Procedures

stored procedure to transform a table
Posted by: Mario Ruocco
Date: May 18, 2014 04:18AM

I need help from someone experienced in the transformation of tables to create a stored procedure.

I have this table:

page | user
----------------------
A | 1
A | 5
A | 7
B | 1
C | 1
C | 3
... | ...

and I need to transform it in this table:

user| A | B | C | ...
----------------------
1 | 1 | 1 | 1 | ...
3 | 0 | 0 | 1 | ...
5 | 1 | 0 | 0 | ...
7 | 1 | 0 | 0 |
... ... ... ... ...

The values of the page are approximately 50-100 and the user 1000. So i cant'n create the new table manually.
The new table must be like a dense matrix. I'm trying to make a stored procedure on MySQL but i have the problem to populate
the new table (...50 udpate where changes the attribute)
can someone help me?

Options: ReplyQuote


Subject
Views
Written By
Posted
stored procedure to transform a table
2045
May 18, 2014 04:18AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.