SELECT
  descr,
  ld.fcst_init_beg,
  ld.fcst_valid_beg,
  ld.fcst_lead,
'T2' fcst_var,
  'ME' stat_name,
  IF(ld.me=-9999,'NA',ld.me ) stat_value,
  IF(ld.me_ncl=-9999,'NA',ld.me_ncl  ) stat_ncl,
  IF(ld.me_ncu=-9999,'NA',ld.me_ncu  ) stat_ncu,
  IF(ld.me_bcl=-9999,'NA',ld.me_bcl) stat_bcl,
  IF(ld.me_bcu=-9999,'NA',ld.me_bcu ) stat_bcu
FROM
  stat_header h,
  line_data_cnt ld
WHERE
    BINARY h.descr IN ('step03', 'step12')
  AND   BINARY ld.fcst_lead IN ('480000', '490000', '500000', '510000', '520000', '530000', '540000', '550000', '560000', '570000', '580000', '590000')
  AND   BINARY h.fcst_var = 'T2'
  AND ld.stat_header_id = h.stat_header_id
  AND ld.me != -9999;

