SELECT
  fcst_lev,
  ld.fcst_init_beg,
  ld.fcst_valid_beg,
  ld.fcst_lead,
  HOUR(fcst_init_beg) init_hour,
'APCP_03' fcst_var,
  'ACC' stat_name,
  IF(ld.acc=-9999,'NA',ld.acc ) stat_value,
  IF(ld.acc_ncl=-9999,'NA',ld.acc_ncl  ) stat_ncl,
  IF(ld.acc_ncu=-9999,'NA',ld.acc_ncu  ) stat_ncu,
  IF(ld.acc_bcl=-9999,'NA',ld.acc_bcl) stat_bcl,
  IF(ld.acc_bcu=-9999,'NA',ld.acc_bcu ) stat_bcu
FROM
  stat_header h,
  line_data_cts ld
WHERE
    BINARY h.fcst_lev IN ('A03')
  AND HOUR(ld.fcst_init_beg) IN ('00')
  AND   BINARY h.fcst_var = 'APCP_03'
  AND ld.stat_header_id = h.stat_header_id
  AND ld.acc != -9999;

