SELECT
  model,
  ld.fcst_init_beg,
  ld.fcst_valid_beg,
  ld.fcst_lead,
  HOUR(fcst_valid_beg) valid_hour,
  vx_mask,
'apcp01' fcst_var,
  'S1' stat_name,
  IF(ld.s1=-9999,'NA',ld.s1 ) stat_value,
  'NA' stat_ncl,
  'NA' stat_ncu,
  IF(ld.s1_bcl=-9999,'NA',ld.s1_bcl) stat_bcl,
  IF(ld.s1_bcu=-9999,'NA',ld.s1_bcu ) stat_bcu
FROM
  stat_header h,
  line_data_cnt ld
WHERE
    BINARY h.vx_mask IN ('FULL')
  AND   BINARY h.model IN ('AI_B1H')
  AND HOUR(ld.fcst_valid_beg) IN ('00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23')
  AND   BINARY h.fcst_var = 'apcp01'
  AND ld.stat_header_id = h.stat_header_id
  AND ld.s1 != -9999;

