2
I have a table (in MySQL) with 3 columns:
Location Category Supplier
A Computers Company X
A Printers Company Y
B Computers Company X
B Printers Company Y
B Software Company Y
C Computers Company Y
C Software Company Z
Now I need to make a matrix containing the above information , like this :
Computers Printers Software
A Company X Company Y
B Company X Company Y Company Y
C Company Y Company Z
Eventually I need to have this in Excel.
In reality I have a variable number of categories, so doing it in MySQL with a join for each column is not a good option. I could write a function in PHP, but I was wondering if there's a more elegant solution.
I looked a pivot tables in Excel, but they seem only suited for numbers as values. But maybe I'm overlooking something, since I never work with Excel myself.
Exact duplicate in stackoverflow. You should ask only in one place. – DavidEG – 2011-10-12T18:08:26.387
Sorry, realized just after posting on stackoverflow that this isn't really a programming question, so I put it on here too – Dylan – 2011-10-12T22:38:26.070