Reputation: 28284
I have a table that holds data like
key val
Product Oranges
Customer Alan Sherry
Product Apples
Area Isles
Customer John C
etc
and I want to change it to more like
Product customer Area
Oranges Alan Sherry Isles
Appleas John C
how would I do that
thanks
Upvotes: 0
Views: 129
Reputation: 5715
This could be hard to do using purely sql. You could use a cursor and look for product, customer, area (in a specific order, maybe?) and set variables for those 3 items until you come to product each time, then you flush the variables you've set into one row in the new table you've created using and insert statement and start reading again.
The statements inside the cursor will depend on the specifics on the data in the key val table.
Upvotes: 1