troubleshooting Question

Row data counted as column headers

Avatar of indsupport
indsupport asked on
DatabasesMySQL Server
18 Comments3 Solutions324 ViewsLast Modified:
I have a table::
order_details: { orderid, amount, productcode, ... }

order_details looks like this:
133, 1, SKU16134
135, 2, SKU16133
135, 1, SKU16134
136, 2, SKU16133
136, 2, SKU16144
137, 1, SKU16133

I'd like to query that table so the sesult looks like this:
orderid, product01, amount01, product02, amount02, product03, amount03 ...

The above example would look like:
133, SKU16134, 1, "", "", ...
135, SKU16133, 2, SKU16134, 1
136, SKU16133, 2, SKU16144, 2
137, SKU16133, 1, "", "", ...

How would I go about doing this?

Thanks!
ASKER CERTIFIED SOLUTION
indsupport

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 18 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros