SELECT
  model,
  ld.fcst_init_beg,
  ld.fcst_valid_beg,
  ld.fcst_lead,
  obtype,
'DPT' fcst_var,
  'FBAR' stat_name,
  IF(ld.fbar=-9999,'NA',ld.fbar ) stat_value,
  IF(ld.fbar_ncl=-9999,'NA',ld.fbar_ncl  ) stat_ncl,
  IF(ld.fbar_ncu=-9999,'NA',ld.fbar_ncu  ) stat_ncu,
  IF(ld.fbar_bcl=-9999,'NA',ld.fbar_bcl) stat_bcl,
  IF(ld.fbar_bcu=-9999,'NA',ld.fbar_bcu ) stat_bcu
FROM
  stat_header h,
  line_data_cnt ld
WHERE
    BINARY h.obtype IN ('SURFACE')
  AND   BINARY h.model IN ('OK_12km_PP')
  AND   BINARY ld.fcst_lead IN ('10000', '20000', '30000', '40000', '50000', '60000')
  AND   BINARY h.fcst_var = 'DPT'
  AND ld.stat_header_id = h.stat_header_id
  AND ld.fbar != -9999;

