SELECT
  model,
  fcst_thresh,
  ld.fcst_init_beg,
  ld.fcst_valid_beg,
  ld.fcst_lead,
  HOUR(fcst_valid_beg) valid_hour,
  vx_mask,
'WRF_precip' fcst_var,
  'FBIAS' stat_name,
  IF(ld.fbias=-9999,'NA',ld.fbias ) stat_value,
  'NA' stat_ncl,
  'NA' stat_ncu,
  IF(ld.fbias_bcl=-9999,'NA',ld.fbias_bcl) stat_bcl,
  IF(ld.fbias_bcu=-9999,'NA',ld.fbias_bcu ) stat_bcu
FROM
  stat_header h,
  line_data_cts ld
WHERE
    BINARY h.vx_mask IN ('AIdom')
  AND   BINARY h.model IN ('AI_run1', 'AI_step06', 'AI_step12')
  AND   BINARY h.fcst_thresh IN ('>=0.254', '>SOP95')
  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 = 'WRF_precip'
  AND ld.stat_header_id = h.stat_header_id
  AND ld.fbias != -9999;

