WITH c AS (
  SELECT
    CAST(COALESCE(SUM(Fluid_Inbound_Merge_1), 0) AS SIGNED) AS Fluid_Inbound_Merge_1,
    CAST(COALESCE(SUM(Fluid_Inbound_Merge_2), 0) AS SIGNED) AS Fluid_Inbound_Merge_2,
    CAST(COALESCE(SUM(Fluid_Inbound_Merge_3), 0) AS SIGNED) AS Fluid_Inbound_Merge_3,
    CAST(COALESCE(SUM(Fluid_Inbound_Merge_4), 0) AS SIGNED) AS Fluid_Inbound_Merge_4,
    CAST(COALESCE(SUM(Fluid_Inbound_Merge_5), 0) AS SIGNED) AS Fluid_Inbound_Merge_5,
    CAST(COALESCE(SUM(Fluid_Inbound_Merge_6), 0) AS SIGNED) AS Fluid_Inbound_Merge_6,
    CAST(COALESCE(SUM(Fluid_Inbound_Merge_7), 0) AS SIGNED) AS Fluid_Inbound_Merge_7,
    CAST(COALESCE(SUM(Non_Con_Merge), 0) AS SIGNED) AS Non_Con_Merge,
    CAST(COALESCE(SUM(NCP), 0) AS SIGNED) AS NCP,
    CAST(COALESCE(SUM(Bulk_Inbound_MCM04), 0) AS SIGNED) AS Bulk_Inbound_MCM04,
    CAST(COALESCE(SUM(Fluid_Outbound_MCM04), 0) AS SIGNED) AS Fluid_Outbound_MCM04,
    CAST(COALESCE(SUM(Problem_Solve_MCM04), 0) AS SIGNED) AS Problem_Solve_MCM04,
    CAST(COALESCE(SUM(Bulk_Inbound_MCM05), 0) AS SIGNED) AS Bulk_Inbound_MCM05,
    CAST(COALESCE(SUM(Fluid_Outbound_MCM05), 0) AS SIGNED) AS Fluid_Outbound_MCM05,
    CAST(COALESCE(SUM(Problem_Solve_MCM05), 0) AS SIGNED) AS Problem_Solve_MCM05,
    CAST(COALESCE(SUM(NCS1), 0) AS SIGNED) AS NCS1,
    CAST(COALESCE(SUM(NCS2), 0) AS SIGNED) AS NCS2,
    CAST(COALESCE(SUM(BYB), 0) AS SIGNED) AS BYB,
    CAST(COALESCE(SUM(BYA), 0) AS SIGNED) AS BYA,
    CAST(COALESCE(SUM(BYC), 0) AS SIGNED) AS BYC,
    CAST(COALESCE(SUM(BYD), 0) AS SIGNED) AS BYD,
    CAST(COALESCE(SUM(Chutes_MCM04), 0) AS SIGNED) AS Chutes_MCM04,
    CAST(COALESCE(SUM(Chutes_MCM05), 0) AS SIGNED) AS Chutes_MCM05
  FROM jam_area
  WHERE t_stamp BETWEEN :starttime AND :endtime
),
t AS (
  SELECT (Fluid_Inbound_Merge_1 + Fluid_Inbound_Merge_2 + Fluid_Inbound_Merge_3 + Fluid_Inbound_Merge_4 + 
          Fluid_Inbound_Merge_5 + Fluid_Inbound_Merge_6 + Fluid_Inbound_Merge_7 + Non_Con_Merge + NCP + 
          Bulk_Inbound_MCM04 + Fluid_Outbound_MCM04 + Problem_Solve_MCM04 + Bulk_Inbound_MCM05 + 
          Fluid_Outbound_MCM05 + Problem_Solve_MCM05 + NCS1 + NCS2 + BYB + BYA + BYC + BYD + 
          Chutes_MCM04 + Chutes_MCM05) AS Total FROM c
)
SELECT 'Fluid_Inbound_Merge_1' AS `Area`,
       ROUND(c.Fluid_Inbound_Merge_1 / NULLIF(t.Total,0) * 100.0, 2) AS `Fluid_Inbound_Merge_1`,
       NULL AS `Fluid_Inbound_Merge_2`, NULL AS `Fluid_Inbound_Merge_3`, NULL AS `Fluid_Inbound_Merge_4`,
       NULL AS `Fluid_Inbound_Merge_5`, NULL AS `Fluid_Inbound_Merge_6`, NULL AS `Fluid_Inbound_Merge_7`,
       NULL AS `Non_Con_Merge`, NULL AS `NCP`, NULL AS `Bulk_Inbound_MCM04`, NULL AS `Fluid_Outbound_MCM04`,
       NULL AS `Problem_Solve_MCM04`, NULL AS `Bulk_Inbound_MCM05`, NULL AS `Fluid_Outbound_MCM05`,
       NULL AS `Problem_Solve_MCM05`, NULL AS `NCS1`, NULL AS `NCS2`, NULL AS `BYB`, NULL AS `BYA`,
       NULL AS `BYC`, NULL AS `BYD`, NULL AS `Chutes_MCM04`, NULL AS `Chutes_MCM05`, 100 AS `Jam_Count`
FROM c CROSS JOIN t
UNION ALL
SELECT 'Fluid_Inbound_Merge_2' AS `Area`,
       NULL AS `Fluid_Inbound_Merge_1`, ROUND(c.Fluid_Inbound_Merge_2 / NULLIF(t.Total,0) * 100.0, 2) AS `Fluid_Inbound_Merge_2`,
       NULL AS `Fluid_Inbound_Merge_3`, NULL AS `Fluid_Inbound_Merge_4`, NULL AS `Fluid_Inbound_Merge_5`,
       NULL AS `Fluid_Inbound_Merge_6`, NULL AS `Fluid_Inbound_Merge_7`, NULL AS `Non_Con_Merge`, NULL AS `NCP`,
       NULL AS `Bulk_Inbound_MCM04`, NULL AS `Fluid_Outbound_MCM04`, NULL AS `Problem_Solve_MCM04`,
       NULL AS `Bulk_Inbound_MCM05`, NULL AS `Fluid_Outbound_MCM05`, NULL AS `Problem_Solve_MCM05`,
       NULL AS `NCS1`, NULL AS `NCS2`, NULL AS `BYB`, NULL AS `BYA`, NULL AS `BYC`, NULL AS `BYD`,
       NULL AS `Chutes_MCM04`, NULL AS `Chutes_MCM05`, 100 AS `Jam_Count`
FROM c CROSS JOIN t
UNION ALL
SELECT 'Fluid_Inbound_Merge_3' AS `Area`,
       NULL AS `Fluid_Inbound_Merge_1`, NULL AS `Fluid_Inbound_Merge_2`, ROUND(c.Fluid_Inbound_Merge_3 / NULLIF(t.Total,0) * 100.0, 2) AS `Fluid_Inbound_Merge_3`,
       NULL AS `Fluid_Inbound_Merge_4`, NULL AS `Fluid_Inbound_Merge_5`, NULL AS `Fluid_Inbound_Merge_6`,
       NULL AS `Fluid_Inbound_Merge_7`, NULL AS `Non_Con_Merge`, NULL AS `NCP`, NULL AS `Bulk_Inbound_MCM04`,
       NULL AS `Fluid_Outbound_MCM04`, NULL AS `Problem_Solve_MCM04`, NULL AS `Bulk_Inbound_MCM05`,
       NULL AS `Fluid_Outbound_MCM05`, NULL AS `Problem_Solve_MCM05`, NULL AS `NCS1`, NULL AS `NCS2`,
       NULL AS `BYB`, NULL AS `BYA`, NULL AS `BYC`, NULL AS `BYD`, NULL AS `Chutes_MCM04`, NULL AS `Chutes_MCM05`,
       100 AS `Jam_Count`
FROM c CROSS JOIN t
UNION ALL
SELECT 'Fluid_Inbound_Merge_4' AS `Area`,
       NULL AS `Fluid_Inbound_Merge_1`, NULL AS `Fluid_Inbound_Merge_2`, NULL AS `Fluid_Inbound_Merge_3`,
       ROUND(c.Fluid_Inbound_Merge_4 / NULLIF(t.Total,0) * 100.0, 2) AS `Fluid_Inbound_Merge_4`,
       NULL AS `Fluid_Inbound_Merge_5`, NULL AS `Fluid_Inbound_Merge_6`, NULL AS `Fluid_Inbound_Merge_7`,
       NULL AS `Non_Con_Merge`, NULL AS `NCP`, NULL AS `Bulk_Inbound_MCM04`, NULL AS `Fluid_Outbound_MCM04`,
       NULL AS `Problem_Solve_MCM04`, NULL AS `Bulk_Inbound_MCM05`, NULL AS `Fluid_Outbound_MCM05`,
       NULL AS `Problem_Solve_MCM05`, NULL AS `NCS1`, NULL AS `NCS2`, NULL AS `BYB`, NULL AS `BYA`,
       NULL AS `BYC`, NULL AS `BYD`, NULL AS `Chutes_MCM04`, NULL AS `Chutes_MCM05`, 100 AS `Jam_Count`
FROM c CROSS JOIN t
UNION ALL
SELECT 'Fluid_Inbound_Merge_5' AS `Area`,
       NULL AS `Fluid_Inbound_Merge_1`, NULL AS `Fluid_Inbound_Merge_2`, NULL AS `Fluid_Inbound_Merge_3`,
       NULL AS `Fluid_Inbound_Merge_4`, ROUND(c.Fluid_Inbound_Merge_5 / NULLIF(t.Total,0) * 100.0, 2) AS `Fluid_Inbound_Merge_5`,
       NULL AS `Fluid_Inbound_Merge_6`, NULL AS `Fluid_Inbound_Merge_7`, NULL AS `Non_Con_Merge`, NULL AS `NCP`,
       NULL AS `Bulk_Inbound_MCM04`, NULL AS `Fluid_Outbound_MCM04`, NULL AS `Problem_Solve_MCM04`,
       NULL AS `Bulk_Inbound_MCM05`, NULL AS `Fluid_Outbound_MCM05`, NULL AS `Problem_Solve_MCM05`,
       NULL AS `NCS1`, NULL AS `NCS2`, NULL AS `BYB`, NULL AS `BYA`, NULL AS `BYC`, NULL AS `BYD`,
       NULL AS `Chutes_MCM04`, NULL AS `Chutes_MCM05`, 100 AS `Jam_Count`
FROM c CROSS JOIN t
UNION ALL
SELECT 'Fluid_Inbound_Merge_6' AS `Area`,
       NULL AS `Fluid_Inbound_Merge_1`, NULL AS `Fluid_Inbound_Merge_2`, NULL AS `Fluid_Inbound_Merge_3`,
       NULL AS `Fluid_Inbound_Merge_4`, NULL AS `Fluid_Inbound_Merge_5`, ROUND(c.Fluid_Inbound_Merge_6 / NULLIF(t.Total,0) * 100.0, 2) AS `Fluid_Inbound_Merge_6`,
       NULL AS `Fluid_Inbound_Merge_7`, NULL AS `Non_Con_Merge`, NULL AS `NCP`, NULL AS `Bulk_Inbound_MCM04`,
       NULL AS `Fluid_Outbound_MCM04`, NULL AS `Problem_Solve_MCM04`, NULL AS `Bulk_Inbound_MCM05`,
       NULL AS `Fluid_Outbound_MCM05`, NULL AS `Problem_Solve_MCM05`, NULL AS `NCS1`, NULL AS `NCS2`,
       NULL AS `BYB`, NULL AS `BYA`, NULL AS `BYC`, NULL AS `BYD`, NULL AS `Chutes_MCM04`, NULL AS `Chutes_MCM05`,
       100 AS `Jam_Count`
FROM c CROSS JOIN t
UNION ALL
SELECT 'Fluid_Inbound_Merge_7' AS `Area`,
       NULL AS `Fluid_Inbound_Merge_1`, NULL AS `Fluid_Inbound_Merge_2`, NULL AS `Fluid_Inbound_Merge_3`,
       NULL AS `Fluid_Inbound_Merge_4`, NULL AS `Fluid_Inbound_Merge_5`, NULL AS `Fluid_Inbound_Merge_6`,
       ROUND(c.Fluid_Inbound_Merge_7 / NULLIF(t.Total,0) * 100.0, 2) AS `Fluid_Inbound_Merge_7`,
       NULL AS `Non_Con_Merge`, NULL AS `NCP`, NULL AS `Bulk_Inbound_MCM04`, NULL AS `Fluid_Outbound_MCM04`,
       NULL AS `Problem_Solve_MCM04`, NULL AS `Bulk_Inbound_MCM05`, NULL AS `Fluid_Outbound_MCM05`,
       NULL AS `Problem_Solve_MCM05`, NULL AS `NCS1`, NULL AS `NCS2`, NULL AS `BYB`, NULL AS `BYA`,
       NULL AS `BYC`, NULL AS `BYD`, NULL AS `Chutes_MCM04`, NULL AS `Chutes_MCM05`, 100 AS `Jam_Count`
FROM c CROSS JOIN t
UNION ALL
SELECT 'Non_Con_Merge' AS `Area`,
       NULL AS `Fluid_Inbound_Merge_1`, NULL AS `Fluid_Inbound_Merge_2`, NULL AS `Fluid_Inbound_Merge_3`,
       NULL AS `Fluid_Inbound_Merge_4`, NULL AS `Fluid_Inbound_Merge_5`, NULL AS `Fluid_Inbound_Merge_6`,
       NULL AS `Fluid_Inbound_Merge_7`, ROUND(c.Non_Con_Merge / NULLIF(t.Total,0) * 100.0, 2) AS `Non_Con_Merge`,
       NULL AS `NCP`, NULL AS `Bulk_Inbound_MCM04`, NULL AS `Fluid_Outbound_MCM04`, NULL AS `Problem_Solve_MCM04`,
       NULL AS `Bulk_Inbound_MCM05`, NULL AS `Fluid_Outbound_MCM05`, NULL AS `Problem_Solve_MCM05`,
       NULL AS `NCS1`, NULL AS `NCS2`, NULL AS `BYB`, NULL AS `BYA`, NULL AS `BYC`, NULL AS `BYD`,
       NULL AS `Chutes_MCM04`, NULL AS `Chutes_MCM05`, 100 AS `Jam_Count`
FROM c CROSS JOIN t
UNION ALL
SELECT 'NCP' AS `Area`,
       NULL AS `Fluid_Inbound_Merge_1`, NULL AS `Fluid_Inbound_Merge_2`, NULL AS `Fluid_Inbound_Merge_3`,
       NULL AS `Fluid_Inbound_Merge_4`, NULL AS `Fluid_Inbound_Merge_5`, NULL AS `Fluid_Inbound_Merge_6`,
       NULL AS `Fluid_Inbound_Merge_7`, NULL AS `Non_Con_Merge`, ROUND(c.NCP / NULLIF(t.Total,0) * 100.0, 2) AS `NCP`,
       NULL AS `Bulk_Inbound_MCM04`, NULL AS `Fluid_Outbound_MCM04`, NULL AS `Problem_Solve_MCM04`,
       NULL AS `Bulk_Inbound_MCM05`, NULL AS `Fluid_Outbound_MCM05`, NULL AS `Problem_Solve_MCM05`,
       NULL AS `NCS1`, NULL AS `NCS2`, NULL AS `BYB`, NULL AS `BYA`, NULL AS `BYC`, NULL AS `BYD`,
       NULL AS `Chutes_MCM04`, NULL AS `Chutes_MCM05`, 100 AS `Jam_Count`
FROM c CROSS JOIN t
UNION ALL
SELECT 'Bulk_Inbound_MCM04' AS `Area`,
       NULL AS `Fluid_Inbound_Merge_1`, NULL AS `Fluid_Inbound_Merge_2`, NULL AS `Fluid_Inbound_Merge_3`,
       NULL AS `Fluid_Inbound_Merge_4`, NULL AS `Fluid_Inbound_Merge_5`, NULL AS `Fluid_Inbound_Merge_6`,
       NULL AS `Fluid_Inbound_Merge_7`, NULL AS `Non_Con_Merge`, NULL AS `NCP`,
       ROUND(c.Bulk_Inbound_MCM04 / NULLIF(t.Total,0) * 100.0, 2) AS `Bulk_Inbound_MCM04`,
       NULL AS `Fluid_Outbound_MCM04`, NULL AS `Problem_Solve_MCM04`, NULL AS `Bulk_Inbound_MCM05`,
       NULL AS `Fluid_Outbound_MCM05`, NULL AS `Problem_Solve_MCM05`, NULL AS `NCS1`, NULL AS `NCS2`,
       NULL AS `BYB`, NULL AS `BYA`, NULL AS `BYC`, NULL AS `BYD`, NULL AS `Chutes_MCM04`, NULL AS `Chutes_MCM05`,
       100 AS `Jam_Count`
FROM c CROSS JOIN t
UNION ALL
SELECT 'Fluid_Outbound_MCM04' AS `Area`,
       NULL AS `Fluid_Inbound_Merge_1`, NULL AS `Fluid_Inbound_Merge_2`, NULL AS `Fluid_Inbound_Merge_3`,
       NULL AS `Fluid_Inbound_Merge_4`, NULL AS `Fluid_Inbound_Merge_5`, NULL AS `Fluid_Inbound_Merge_6`,
       NULL AS `Fluid_Inbound_Merge_7`, NULL AS `Non_Con_Merge`, NULL AS `NCP`, NULL AS `Bulk_Inbound_MCM04`,
       ROUND(c.Fluid_Outbound_MCM04 / NULLIF(t.Total,0) * 100.0, 2) AS `Fluid_Outbound_MCM04`,
       NULL AS `Problem_Solve_MCM04`, NULL AS `Bulk_Inbound_MCM05`, NULL AS `Fluid_Outbound_MCM05`,
       NULL AS `Problem_Solve_MCM05`, NULL AS `NCS1`, NULL AS `NCS2`, NULL AS `BYB`, NULL AS `BYA`,
       NULL AS `BYC`, NULL AS `BYD`, NULL AS `Chutes_MCM04`, NULL AS `Chutes_MCM05`, 100 AS `Jam_Count`
FROM c CROSS JOIN t
UNION ALL
SELECT 'Problem_Solve_MCM04' AS `Area`,
       NULL AS `Fluid_Inbound_Merge_1`, NULL AS `Fluid_Inbound_Merge_2`, NULL AS `Fluid_Inbound_Merge_3`,
       NULL AS `Fluid_Inbound_Merge_4`, NULL AS `Fluid_Inbound_Merge_5`, NULL AS `Fluid_Inbound_Merge_6`,
       NULL AS `Fluid_Inbound_Merge_7`, NULL AS `Non_Con_Merge`, NULL AS `NCP`, NULL AS `Bulk_Inbound_MCM04`,
       NULL AS `Fluid_Outbound_MCM04`, ROUND(c.Problem_Solve_MCM04 / NULLIF(t.Total,0) * 100.0, 2) AS `Problem_Solve_MCM04`,
       NULL AS `Bulk_Inbound_MCM05`, NULL AS `Fluid_Outbound_MCM05`, NULL AS `Problem_Solve_MCM05`,
       NULL AS `NCS1`, NULL AS `NCS2`, NULL AS `BYB`, NULL AS `BYA`, NULL AS `BYC`, NULL AS `BYD`,
       NULL AS `Chutes_MCM04`, NULL AS `Chutes_MCM05`, 100 AS `Jam_Count`
FROM c CROSS JOIN t
UNION ALL
SELECT 'Bulk_Inbound_MCM05' AS `Area`,
       NULL AS `Fluid_Inbound_Merge_1`, NULL AS `Fluid_Inbound_Merge_2`, NULL AS `Fluid_Inbound_Merge_3`,
       NULL AS `Fluid_Inbound_Merge_4`, NULL AS `Fluid_Inbound_Merge_5`, NULL AS `Fluid_Inbound_Merge_6`,
       NULL AS `Fluid_Inbound_Merge_7`, NULL AS `Non_Con_Merge`, NULL AS `NCP`, NULL AS `Bulk_Inbound_MCM04`,
       NULL AS `Fluid_Outbound_MCM04`, NULL AS `Problem_Solve_MCM04`,
       ROUND(c.Bulk_Inbound_MCM05 / NULLIF(t.Total,0) * 100.0, 2) AS `Bulk_Inbound_MCM05`,
       NULL AS `Fluid_Outbound_MCM05`, NULL AS `Problem_Solve_MCM05`, NULL AS `NCS1`, NULL AS `NCS2`,
       NULL AS `BYB`, NULL AS `BYA`, NULL AS `BYC`, NULL AS `BYD`, NULL AS `Chutes_MCM04`, NULL AS `Chutes_MCM05`,
       100 AS `Jam_Count`
FROM c CROSS JOIN t
UNION ALL
SELECT 'Fluid_Outbound_MCM05' AS `Area`,
       NULL AS `Fluid_Inbound_Merge_1`, NULL AS `Fluid_Inbound_Merge_2`, NULL AS `Fluid_Inbound_Merge_3`,
       NULL AS `Fluid_Inbound_Merge_4`, NULL AS `Fluid_Inbound_Merge_5`, NULL AS `Fluid_Inbound_Merge_6`,
       NULL AS `Fluid_Inbound_Merge_7`, NULL AS `Non_Con_Merge`, NULL AS `NCP`, NULL AS `Bulk_Inbound_MCM04`,
       NULL AS `Fluid_Outbound_MCM04`, NULL AS `Problem_Solve_MCM04`, NULL AS `Bulk_Inbound_MCM05`,
       ROUND(c.Fluid_Outbound_MCM05 / NULLIF(t.Total,0) * 100.0, 2) AS `Fluid_Outbound_MCM05`,
       NULL AS `Problem_Solve_MCM05`, NULL AS `NCS1`, NULL AS `NCS2`, NULL AS `BYB`, NULL AS `BYA`,
       NULL AS `BYC`, NULL AS `BYD`, NULL AS `Chutes_MCM04`, NULL AS `Chutes_MCM05`, 100 AS `Jam_Count`
FROM c CROSS JOIN t
UNION ALL
SELECT 'Problem_Solve_MCM05' AS `Area`,
       NULL AS `Fluid_Inbound_Merge_1`, NULL AS `Fluid_Inbound_Merge_2`, NULL AS `Fluid_Inbound_Merge_3`,
       NULL AS `Fluid_Inbound_Merge_4`, NULL AS `Fluid_Inbound_Merge_5`, NULL AS `Fluid_Inbound_Merge_6`,
       NULL AS `Fluid_Inbound_Merge_7`, NULL AS `Non_Con_Merge`, NULL AS `NCP`, NULL AS `Bulk_Inbound_MCM04`,
       NULL AS `Fluid_Outbound_MCM04`, NULL AS `Problem_Solve_MCM04`, NULL AS `Bulk_Inbound_MCM05`,
       NULL AS `Fluid_Outbound_MCM05`, ROUND(c.Problem_Solve_MCM05 / NULLIF(t.Total,0) * 100.0, 2) AS `Problem_Solve_MCM05`,
       NULL AS `NCS1`, NULL AS `NCS2`, NULL AS `BYB`, NULL AS `BYA`, NULL AS `BYC`, NULL AS `BYD`,
       NULL AS `Chutes_MCM04`, NULL AS `Chutes_MCM05`, 100 AS `Jam_Count`
FROM c CROSS JOIN t
UNION ALL
SELECT 'NCS1' AS `Area`,
       NULL AS `Fluid_Inbound_Merge_1`, NULL AS `Fluid_Inbound_Merge_2`, NULL AS `Fluid_Inbound_Merge_3`,
       NULL AS `Fluid_Inbound_Merge_4`, NULL AS `Fluid_Inbound_Merge_5`, NULL AS `Fluid_Inbound_Merge_6`,
       NULL AS `Fluid_Inbound_Merge_7`, NULL AS `Non_Con_Merge`, NULL AS `NCP`, NULL AS `Bulk_Inbound_MCM04`,
       NULL AS `Fluid_Outbound_MCM04`, NULL AS `Problem_Solve_MCM04`, NULL AS `Bulk_Inbound_MCM05`,
       NULL AS `Fluid_Outbound_MCM05`, NULL AS `Problem_Solve_MCM05`,
       ROUND(c.NCS1 / NULLIF(t.Total,0) * 100.0, 2) AS `NCS1`, NULL AS `NCS2`, NULL AS `BYB`, NULL AS `BYA`,
       NULL AS `BYC`, NULL AS `BYD`, NULL AS `Chutes_MCM04`, NULL AS `Chutes_MCM05`, 100 AS `Jam_Count`
FROM c CROSS JOIN t
UNION ALL
SELECT 'NCS2' AS `Area`,
       NULL AS `Fluid_Inbound_Merge_1`, NULL AS `Fluid_Inbound_Merge_2`, NULL AS `Fluid_Inbound_Merge_3`,
       NULL AS `Fluid_Inbound_Merge_4`, NULL AS `Fluid_Inbound_Merge_5`, NULL AS `Fluid_Inbound_Merge_6`,
       NULL AS `Fluid_Inbound_Merge_7`, NULL AS `Non_Con_Merge`, NULL AS `NCP`, NULL AS `Bulk_Inbound_MCM04`,
       NULL AS `Fluid_Outbound_MCM04`, NULL AS `Problem_Solve_MCM04`, NULL AS `Bulk_Inbound_MCM05`,
       NULL AS `Fluid_Outbound_MCM05`, NULL AS `Problem_Solve_MCM05`, NULL AS `NCS1`,
       ROUND(c.NCS2 / NULLIF(t.Total,0) * 100.0, 2) AS `NCS2`, NULL AS `BYB`, NULL AS `BYA`, NULL AS `BYC`,
       NULL AS `BYD`, NULL AS `Chutes_MCM04`, NULL AS `Chutes_MCM05`, 100 AS `Jam_Count`
FROM c CROSS JOIN t
UNION ALL
SELECT 'BYB' AS `Area`,
       NULL AS `Fluid_Inbound_Merge_1`, NULL AS `Fluid_Inbound_Merge_2`, NULL AS `Fluid_Inbound_Merge_3`,
       NULL AS `Fluid_Inbound_Merge_4`, NULL AS `Fluid_Inbound_Merge_5`, NULL AS `Fluid_Inbound_Merge_6`,
       NULL AS `Fluid_Inbound_Merge_7`, NULL AS `Non_Con_Merge`, NULL AS `NCP`, NULL AS `Bulk_Inbound_MCM04`,
       NULL AS `Fluid_Outbound_MCM04`, NULL AS `Problem_Solve_MCM04`, NULL AS `Bulk_Inbound_MCM05`,
       NULL AS `Fluid_Outbound_MCM05`, NULL AS `Problem_Solve_MCM05`, NULL AS `NCS1`, NULL AS `NCS2`,
       ROUND(c.BYB / NULLIF(t.Total,0) * 100.0, 2) AS `BYB`, NULL AS `BYA`, NULL AS `BYC`, NULL AS `BYD`,
       NULL AS `Chutes_MCM04`, NULL AS `Chutes_MCM05`, 100 AS `Jam_Count`
FROM c CROSS JOIN t
UNION ALL
SELECT 'BYA' AS `Area`,
       NULL AS `Fluid_Inbound_Merge_1`, NULL AS `Fluid_Inbound_Merge_2`, NULL AS `Fluid_Inbound_Merge_3`,
       NULL AS `Fluid_Inbound_Merge_4`, NULL AS `Fluid_Inbound_Merge_5`, NULL AS `Fluid_Inbound_Merge_6`,
       NULL AS `Fluid_Inbound_Merge_7`, NULL AS `Non_Con_Merge`, NULL AS `NCP`, NULL AS `Bulk_Inbound_MCM04`,
       NULL AS `Fluid_Outbound_MCM04`, NULL AS `Problem_Solve_MCM04`, NULL AS `Bulk_Inbound_MCM05`,
       NULL AS `Fluid_Outbound_MCM05`, NULL AS `Problem_Solve_MCM05`, NULL AS `NCS1`, NULL AS `NCS2`,
       NULL AS `BYB`, ROUND(c.BYA / NULLIF(t.Total,0) * 100.0, 2) AS `BYA`, NULL AS `BYC`, NULL AS `BYD`,
       NULL AS `Chutes_MCM04`, NULL AS `Chutes_MCM05`, 100 AS `Jam_Count`
FROM c CROSS JOIN t
UNION ALL
SELECT 'BYC' AS `Area`,
       NULL AS `Fluid_Inbound_Merge_1`, NULL AS `Fluid_Inbound_Merge_2`, NULL AS `Fluid_Inbound_Merge_3`,
       NULL AS `Fluid_Inbound_Merge_4`, NULL AS `Fluid_Inbound_Merge_5`, NULL AS `Fluid_Inbound_Merge_6`,
       NULL AS `Fluid_Inbound_Merge_7`, NULL AS `Non_Con_Merge`, NULL AS `NCP`, NULL AS `Bulk_Inbound_MCM04`,
       NULL AS `Fluid_Outbound_MCM04`, NULL AS `Problem_Solve_MCM04`, NULL AS `Bulk_Inbound_MCM05`,
       NULL AS `Fluid_Outbound_MCM05`, NULL AS `Problem_Solve_MCM05`, NULL AS `NCS1`, NULL AS `NCS2`,
       NULL AS `BYB`, NULL AS `BYA`, ROUND(c.BYC / NULLIF(t.Total,0) * 100.0, 2) AS `BYC`, NULL AS `BYD`,
       NULL AS `Chutes_MCM04`, NULL AS `Chutes_MCM05`, 100 AS `Jam_Count`
FROM c CROSS JOIN t
UNION ALL
SELECT 'BYD' AS `Area`,
       NULL AS `Fluid_Inbound_Merge_1`, NULL AS `Fluid_Inbound_Merge_2`, NULL AS `Fluid_Inbound_Merge_3`,
       NULL AS `Fluid_Inbound_Merge_4`, NULL AS `Fluid_Inbound_Merge_5`, NULL AS `Fluid_Inbound_Merge_6`,
       NULL AS `Fluid_Inbound_Merge_7`, NULL AS `Non_Con_Merge`, NULL AS `NCP`, NULL AS `Bulk_Inbound_MCM04`,
       NULL AS `Fluid_Outbound_MCM04`, NULL AS `Problem_Solve_MCM04`, NULL AS `Bulk_Inbound_MCM05`,
       NULL AS `Fluid_Outbound_MCM05`, NULL AS `Problem_Solve_MCM05`, NULL AS `NCS1`, NULL AS `NCS2`,
       NULL AS `BYB`, NULL AS `BYA`, NULL AS `BYC`, ROUND(c.BYD / NULLIF(t.Total,0) * 100.0, 2) AS `BYD`,
       NULL AS `Chutes_MCM04`, NULL AS `Chutes_MCM05`, 100 AS `Jam_Count`
FROM c CROSS JOIN t
UNION ALL
SELECT 'Chutes_MCM04' AS `Area`,
       NULL AS `Fluid_Inbound_Merge_1`, NULL AS `Fluid_Inbound_Merge_2`, NULL AS `Fluid_Inbound_Merge_3`,
       NULL AS `Fluid_Inbound_Merge_4`, NULL AS `Fluid_Inbound_Merge_5`, NULL AS `Fluid_Inbound_Merge_6`,
       NULL AS `Fluid_Inbound_Merge_7`, NULL AS `Non_Con_Merge`, NULL AS `NCP`, NULL AS `Bulk_Inbound_MCM04`,
       NULL AS `Fluid_Outbound_MCM04`, NULL AS `Problem_Solve_MCM04`, NULL AS `Bulk_Inbound_MCM05`,
       NULL AS `Fluid_Outbound_MCM05`, NULL AS `Problem_Solve_MCM05`, NULL AS `NCS1`, NULL AS `NCS2`,
       NULL AS `BYB`, NULL AS `BYA`, NULL AS `BYC`, NULL AS `BYD`,
       ROUND(c.Chutes_MCM04 / NULLIF(t.Total,0) * 100.0, 2) AS `Chutes_MCM04`, NULL AS `Chutes_MCM05`,
       100 AS `Jam_Count`
FROM c CROSS JOIN t
UNION ALL
SELECT 'Chutes_MCM05' AS `Area`,
       NULL AS `Fluid_Inbound_Merge_1`, NULL AS `Fluid_Inbound_Merge_2`, NULL AS `Fluid_Inbound_Merge_3`,
       NULL AS `Fluid_Inbound_Merge_4`, NULL AS `Fluid_Inbound_Merge_5`, NULL AS `Fluid_Inbound_Merge_6`,
       NULL AS `Fluid_Inbound_Merge_7`, NULL AS `Non_Con_Merge`, NULL AS `NCP`, NULL AS `Bulk_Inbound_MCM04`,
       NULL AS `Fluid_Outbound_MCM04`, NULL AS `Problem_Solve_MCM04`, NULL AS `Bulk_Inbound_MCM05`,
       NULL AS `Fluid_Outbound_MCM05`, NULL AS `Problem_Solve_MCM05`, NULL AS `NCS1`, NULL AS `NCS2`,
       NULL AS `BYB`, NULL AS `BYA`, NULL AS `BYC`, NULL AS `BYD`, NULL AS `Chutes_MCM04`,
       ROUND(c.Chutes_MCM05 / NULLIF(t.Total,0) * 100.0, 2) AS `Chutes_MCM05`, 100 AS `Jam_Count`
FROM c CROSS JOIN t;
