Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> How do I transpose a table?
I think the word for this is transpose but I am not sure.
I have a table which is in the following format
Customer 1 Subscriber 1 Customer 1 Subscriber 2 Customer 1 Subscriber 3 Customer 1 Subscriber 4 Customer 2 Subscriber 5 Customer 2 Subscriber 6 Customer 3 Subscriber 7 Customer 3 Subscriber 8
I need to transform this table into the following format so there is only one record for each customer and the subscriber fields 1-x are going across the table.
Customer 1 Subscriber 1 Subscriber 2 Subscriber 3 Subscriber 4 Customer 2 Subscriber 5 Subscriber 6 Customer 3 Subscriber 7 Subscriber 8
Its unusual that a customer will more than 4 subscriptions but basically I will not no which customer has the most subscriptions until a process the table in some way, I assume I would need this information to decide how many subscription columns to create on the new table. am i making sense?
Is there any code SQL out there that will already do this that I could edit as I am very stuck.
thanks
Lee leefarrant_at_hotmail.com Received on Wed May 15 2002 - 13:35:53 CDT