SELECT
  model,
  ld.fcst_init_beg,
  ld.fcst_valid_beg,
  ld.fcst_lead,
'APCP_01' fcst_var,
  'NBR_PODY' stat_name,
  IF(ld.pody=-9999,'NA',ld.pody ) stat_value,
  IF(ld.pody_ncl=-9999,'NA',ld.pody_ncl  ) stat_ncl,
  IF(ld.pody_ncu=-9999,'NA',ld.pody_ncu  ) stat_ncu,
  IF(ld.pody_bcl=-9999,'NA',ld.pody_bcl) stat_bcl,
  IF(ld.pody_bcu=-9999,'NA',ld.pody_bcu ) stat_bcu
FROM
  stat_header h,
  line_data_nbrcts ld
WHERE
    BINARY h.model IN ('HRRR_mem000')
  AND   BINARY ld.fcst_lead IN ('10000', '20000', '30000')
  AND   BINARY h.fcst_var = 'APCP_01'
  AND ld.stat_header_id = h.stat_header_id
  AND ld.pody != -9999;

