I'm a new member but long time reader; I've learned so much from the folks here.
I'm trying to get some mysql output to format using perl.
I've got 2 output columns, cartypes & manufacturers, and a third output which is counts.
I've been trying to use a hash reference to basically list the cartypes down the y axis, and car manufacturers across the x, and loop through basically populating a matrix with the counts.
So count of Chevy 4x4 trucks. And hopefully include 0's if there is no match. The timeframe is handled in the sql and not affecting the output other than the counts.
And, if possible, how to total the row and column counts would be ideal. CSV would be the likely end product.
I just don't know how to start. Any guidance would be greatly appreciated. Thank you.
Sample data
cartype Manufacturer count(*)
Convertible Audi 3
Convertible Chrysler 1
Coupe Aston 5
Coupe Audi 2
Coupe Chrysler 2
Etc Etc 0
Minivan Chevy 2
Minivan Chrysler 6
Minivan Dodge 3
Minivan Ford 4
SUV Audi 2
SUV Buick 1
SUV Dodge 2
SUV Ford 5
Sedan Audi 3
Sedan Buick 2
Sedan Chevy 3
Sedan Chrysler 2
Sedan Dodge 2
Sedan Ford 5
Hopeful output
Aston Audi Buick Chevy Chrysler Dodge Ford etc TOTAL
Convertible 0 3 0 0 1 0 0 0 4
Coupe 5 2 0 0 2 0 0 0 9
Minivan 0 0 0 2 6 3 4 0 15
SUV 0 2 1 0 0 2 5 0 10
Sedan 0 3 2 3 2 2 5 0 17
etc 0 0 0 0 0 0 0 0 0
TOTAL 5 10 3 5 11 7 14 0 55
Thank you Oesor for the reformatting. Much obliged.