SELECT `month`,
MAX(CASE WHEN transporttype = 'Inbound' THEN loads ELSE NULL END) `Inbound`,
MAX(CASE WHEN transporttype = 'LocalGauteng' THEN loads ELSE NULL END) `LocalGauteng`,
MAX(CASE WHEN transporttype = 'LongDistance' THEN loads ELSE NULL END) `LongDistance`,
MAX(CASE WHEN transporttype = 'Shuttle-company1' THEN loads ELSE NULL END) `Shuttle-company1`,
MAX(CASE WHEN transporttype = 'Shuttle-company2' THEN loads ELSE NULL END) `Shuttle-company2`,
MAX(CASE WHEN transporttype = 'stores' THEN loads ELSE NULL END) `stores`,
MAX(CASE WHEN transporttype = 'returns' THEN loads ELSE NULL END) `returns`,
MAX(CASE WHEN transporttype = 'localkzn' THEN loads ELSE NULL END) `localkzn`
FROM
(
SELECT transporttype,
CONCAT(MONTHNAME(STR_TO_DATE(month, '%m')), ' ', year) AS `month`,
COUNT(loadnumber) AS loads
FROM v2ReportingTable
WHERE transporttype not in ('Extrusions-LongDistance','Extrusions-Shuttle') AND
urgent='no'
GROUP BY (concat(MONTHNAME(STR_TO_DATE(month, '%m')),' ',year)), transporttype
) aa
GROUP BY `month`