I have a query that is displaying some information from various tables in a database.
SELECT
c.Name,
jp.PieceType,
jp.Qty
FROM customer c
LEFT JOIN job_new jn ON c.JobID = jn.ID
LEFT JOIN job_pieces jp ON c.JobID = jp.JobID
WHERE c.Company_ID = 123
GROUP BY c.ID
I created the database on sqlfiddle: http://www.sqlfiddle.com/#!9/13230/8
Each company can have many piece types but right now the query only displays one type even though more exist. In the sqlfiddle database you can see company 123 has 3 PieceTypes.
So I want to display the piece types as columns instead of rows.
I want the PieceTypes to be displayed in separate columns like this: