SELECT
  DATE_FORMAT(:starttime, '%Y-%m-%d %H:%i') AS StartTimestamp,
  DATE_FORMAT(:endtime,   '%Y-%m-%d %H:%i') AS EndTimestamp,
  COALESCE(c.U1,0) + COALESCE(c.U2,0) + COALESCE(c.U3,0) + COALESCE(c.U4,0) AS Total,
  COALESCE(c.U1,0) AS ULC1,
  COALESCE(c.U2,0) AS ULC2,
  COALESCE(c.U3,0) AS ULC3,
  COALESCE(c.U4,0) AS ULC4
FROM (SELECT 1) AS p
LEFT JOIN (
  SELECT
    SUM(ulc1 = 1) AS U1,
    SUM(ulc2 = 1) AS U2,
    SUM(ulc3 = 1) AS U3,
    SUM(ulc4 = 1) AS U4
  FROM dumper_cycles
  WHERE t_stamp BETWEEN :starttime AND :endtime
) AS c ON 1=1;
