Hi All,
On another thread I asked for some advice on creating a pivot table from data, I have now managed to create the table I want using this code.
SELECT OrigClassID, SUM( if( Disposal = 'Service', 1, 0 ) ) AS
"Service", SUM( if( Disposal = 'Stored', 1, 0 ) ) AS "Stored",
SUM( if( Disposal = 'Scrapped', 1, 0 ) ) AS "Scrapped", SUM(
if( Disposal = 'Preserved', 1, 0 ) ) AS "Preserved", SUM( if(
Disposal = 'Unknown', 1, 0 ) ) AS "Unknown", COUNT( * ) AS
"Total"
FROM growl_locos
GROUP BY OrigClassID
UNION
SELECT 'Total' AS OrigClassID, SUM( if( Disposal = 'Service',
1, 0 ) ) AS "Service", SUM( if( Disposal = 'Stored', 1, 0 ) )
AS "Stored", SUM( if( Disposal = 'Scrapped', 1, 0 ) ) AS
"Scrapped", SUM( if( Disposal = 'Preserved', 1, 0 ) ) AS
"Preserved", SUM( if( Disposal = 'Unknown', 1, 0 ) ) AS
"Unknown", COUNT( * ) AS "Total"
FROM growl_locos
I need a little advice now on publishing the results, I usually use Dreamweaver to create my pages and I am a little confused on how to recreate it on the page using php, etc.