SELECT
  model,
  fcst_thresh,
  ld.fcst_init_beg,
  ld.fcst_valid_beg,
  ld.fcst_lead,
'MOSA' fcst_var,
  'CSI' stat_name,
  'NA' stat_value,
  ld.total,
  ld.fy_oy,
  ld.fy_on,
  ld.fn_oy,
  ld.fn_on,
  ld.ec_value 
FROM
  stat_header h,
  line_data_ctc ld
WHERE
    BINARY ld.fcst_valid_beg IN ('2021-09-01 00:00:00', '2021-09-01 01:00:00', '2021-09-01 02:00:00', '2021-09-01 03:00:00', '2021-09-01 04:00:00', '2021-09-01 05:00:00', '2021-09-01 06:00:00', '2021-09-01 07:00:00', '2021-09-01 08:00:00', '2021-09-01 09:00:00', '2021-09-01 10:00:00', '2021-09-01 11:00:00', '2021-09-01 12:00:00', '2021-09-01 13:00:00', '2021-09-01 14:00:00', '2021-09-01 15:00:00', '2021-09-01 16:00:00', '2021-09-01 17:00:00', '2021-09-01 18:00:00', '2021-09-01 19:00:00', '2021-09-01 20:00:00', '2021-09-01 21:00:00', '2021-09-01 22:00:00', '2021-09-01 23:00:00', '2021-09-02 00:00:00', '2021-09-02 01:00:00', '2021-09-02 02:00:00', '2021-09-02 03:00:00', '2021-09-02 04:00:00', '2021-09-02 05:00:00', '2021-09-02 06:00:00', '2021-09-02 07:00:00', '2021-09-02 08:00:00', '2021-09-02 09:00:00', '2021-09-02 10:00:00', '2021-09-02 11:00:00', '2021-09-02 12:00:00', '2021-09-02 13:00:00', '2021-09-02 14:00:00', '2021-09-02 15:00:00', '2021-09-02 16:00:00', '2021-09-02 17:00:00', '2021-09-02 18:00:00', '2021-09-02 19:00:00', '2021-09-02 20:00:00', '2021-09-02 21:00:00', '2021-09-02 22:00:00', '2021-09-02 23:00:00', '2021-09-03 00:00:00', '2021-09-03 01:00:00', '2021-09-03 02:00:00', '2021-09-03 03:00:00', '2021-09-03 04:00:00', '2021-09-03 05:00:00', '2021-09-03 06:00:00', '2021-09-03 07:00:00', '2021-09-03 08:00:00', '2021-09-03 09:00:00', '2021-09-03 10:00:00', '2021-09-03 11:00:00', '2021-09-03 12:00:00', '2021-09-03 13:00:00', '2021-09-03 14:00:00', '2021-09-03 15:00:00', '2021-09-03 16:00:00', '2021-09-03 17:00:00', '2021-09-03 18:00:00', '2021-09-03 19:00:00', '2021-09-03 20:00:00', '2021-09-03 21:00:00', '2021-09-03 22:00:00', '2021-09-03 23:00:00', '2021-09-04 00:00:00', '2021-09-04 01:00:00', '2021-09-04 02:00:00', '2021-09-04 03:00:00', '2021-09-04 04:00:00', '2021-09-04 05:00:00', '2021-09-04 06:00:00', '2021-09-04 07:00:00', '2021-09-04 08:00:00', '2021-09-04 09:00:00', '2021-09-04 10:00:00', '2021-09-04 11:00:00', '2021-09-04 12:00:00', '2021-09-04 13:00:00', '2021-09-04 14:00:00', '2021-09-04 15:00:00', '2021-09-04 16:00:00', '2021-09-04 17:00:00', '2021-09-04 18:00:00', '2021-09-04 19:00:00', '2021-09-04 20:00:00', '2021-09-04 21:00:00', '2021-09-04 22:00:00', '2021-09-04 23:00:00', '2021-09-05 00:00:00', '2021-09-05 01:00:00', '2021-09-05 02:00:00', '2021-09-05 03:00:00', '2021-09-05 04:00:00', '2021-09-05 05:00:00', '2021-09-05 06:00:00', '2021-09-05 07:00:00', '2021-09-05 08:00:00', '2021-09-05 09:00:00', '2021-09-05 10:00:00', '2021-09-05 11:00:00', '2021-09-05 12:00:00', '2021-09-05 13:00:00', '2021-09-05 14:00:00', '2021-09-05 15:00:00', '2021-09-05 16:00:00', '2021-09-05 17:00:00', '2021-09-05 18:00:00', '2021-09-05 19:00:00', '2021-09-05 20:00:00', '2021-09-05 21:00:00', '2021-09-05 22:00:00', '2021-09-05 23:00:00', '2021-09-06 00:00:00', '2021-09-06 01:00:00', '2021-09-06 02:00:00', '2021-09-06 03:00:00', '2021-09-06 04:00:00', '2021-09-06 05:00:00', '2021-09-06 06:00:00', '2021-09-06 07:00:00', '2021-09-06 08:00:00', '2021-09-06 09:00:00', '2021-09-06 10:00:00', '2021-09-06 11:00:00', '2021-09-06 12:00:00', '2021-09-06 13:00:00', '2021-09-06 14:00:00', '2021-09-06 15:00:00', '2021-09-06 16:00:00', '2021-09-06 17:00:00', '2021-09-06 18:00:00', '2021-09-06 19:00:00', '2021-09-06 20:00:00', '2021-09-06 21:00:00', '2021-09-06 22:00:00', '2021-09-06 23:00:00', '2021-09-07 00:00:00', '2021-09-07 01:00:00', '2021-09-07 02:00:00', '2021-09-07 03:00:00', '2021-09-07 04:00:00', '2021-09-07 05:00:00', '2021-09-07 06:00:00', '2021-09-07 07:00:00', '2021-09-07 08:00:00', '2021-09-07 09:00:00', '2021-09-07 10:00:00', '2021-09-07 11:00:00', '2021-09-07 12:00:00', '2021-09-07 13:00:00', '2021-09-07 14:00:00', '2021-09-07 15:00:00', '2021-09-07 16:00:00', '2021-09-07 17:00:00', '2021-09-07 18:00:00', '2021-09-07 19:00:00', '2021-09-07 20:00:00', '2021-09-07 21:00:00', '2021-09-07 22:00:00', '2021-09-07 23:00:00', '2021-09-08 00:00:00', '2021-09-08 01:00:00', '2021-09-08 02:00:00', '2021-09-08 03:00:00', '2021-09-08 04:00:00', '2021-09-08 05:00:00', '2021-09-08 06:00:00', '2021-09-08 07:00:00', '2021-09-08 08:00:00', '2021-09-08 09:00:00', '2021-09-08 10:00:00', '2021-09-08 11:00:00', '2021-09-08 12:00:00', '2021-09-08 13:00:00', '2021-09-08 14:00:00', '2021-09-08 15:00:00', '2021-09-08 16:00:00', '2021-09-08 17:00:00', '2021-09-08 18:00:00', '2021-09-08 19:00:00', '2021-09-08 20:00:00', '2021-09-08 21:00:00', '2021-09-08 22:00:00', '2021-09-08 23:00:00', '2021-09-09 00:00:00', '2021-09-09 01:00:00', '2021-09-09 02:00:00', '2021-09-09 03:00:00', '2021-09-09 04:00:00', '2021-09-09 05:00:00', '2021-09-09 06:00:00', '2021-09-09 07:00:00', '2021-09-09 08:00:00', '2021-09-09 09:00:00', '2021-09-09 10:00:00', '2021-09-09 11:00:00', '2021-09-09 12:00:00', '2021-09-09 13:00:00', '2021-09-09 14:00:00', '2021-09-09 15:00:00', '2021-09-09 16:00:00', '2021-09-09 17:00:00', '2021-09-09 18:00:00', '2021-09-09 19:00:00', '2021-09-09 20:00:00', '2021-09-09 21:00:00', '2021-09-09 22:00:00', '2021-09-09 23:00:00', '2021-09-10 00:00:00', '2021-09-10 01:00:00', '2021-09-10 02:00:00', '2021-09-10 03:00:00', '2021-09-10 04:00:00', '2021-09-10 05:00:00', '2021-09-10 06:00:00', '2021-09-10 07:00:00', '2021-09-10 08:00:00', '2021-09-10 09:00:00', '2021-09-10 10:00:00', '2021-09-10 11:00:00', '2021-09-10 12:00:00', '2021-09-10 13:00:00', '2021-09-10 14:00:00', '2021-09-10 15:00:00', '2021-09-10 16:00:00', '2021-09-10 17:00:00', '2021-09-12 21:00:00', '2021-09-12 22:00:00', '2021-09-12 23:00:00', '2021-09-13 00:00:00', '2021-09-13 01:00:00', '2021-09-13 02:00:00', '2021-09-13 03:00:00', '2021-09-13 04:00:00', '2021-09-13 05:00:00', '2021-09-13 06:00:00', '2021-09-13 07:00:00', '2021-09-13 08:00:00', '2021-09-13 09:00:00', '2021-09-13 10:00:00', '2021-09-13 11:00:00', '2021-09-13 12:00:00', '2021-09-13 13:00:00', '2021-09-13 14:00:00', '2021-09-13 15:00:00', '2021-09-13 16:00:00', '2021-09-13 17:00:00', '2021-09-13 18:00:00', '2021-09-13 19:00:00', '2021-09-13 20:00:00', '2021-09-13 21:00:00', '2021-09-13 22:00:00', '2021-09-13 23:00:00', '2021-09-14 00:00:00', '2021-09-14 01:00:00', '2021-09-14 02:00:00', '2021-09-14 03:00:00', '2021-09-14 04:00:00', '2021-09-14 05:00:00', '2021-09-14 06:00:00', '2021-09-14 07:00:00', '2021-09-14 08:00:00', '2021-09-14 09:00:00', '2021-09-14 10:00:00', '2021-09-14 11:00:00', '2021-09-14 12:00:00', '2021-09-14 13:00:00', '2021-09-14 14:00:00', '2021-09-14 15:00:00', '2021-09-14 16:00:00', '2021-09-14 17:00:00', '2021-09-14 18:00:00', '2021-09-14 19:00:00', '2021-09-14 20:00:00', '2021-09-14 21:00:00', '2021-09-14 22:00:00', '2021-09-14 23:00:00', '2021-09-15 00:00:00', '2021-09-15 01:00:00', '2021-09-15 02:00:00', '2021-09-15 03:00:00', '2021-09-15 04:00:00', '2021-09-15 05:00:00', '2021-09-15 06:00:00', '2021-09-15 07:00:00', '2021-09-15 08:00:00', '2021-09-15 09:00:00', '2021-09-15 10:00:00', '2021-09-15 11:00:00', '2021-09-15 12:00:00', '2021-09-15 13:00:00', '2021-09-15 14:00:00', '2021-09-15 15:00:00', '2021-09-15 16:00:00', '2021-09-15 17:00:00', '2021-09-15 18:00:00', '2021-09-15 19:00:00', '2021-09-15 20:00:00', '2021-09-15 21:00:00', '2021-09-15 22:00:00', '2021-09-15 23:00:00', '2021-09-16 00:00:00', '2021-09-16 01:00:00', '2021-09-16 02:00:00', '2021-09-16 03:00:00', '2021-09-16 04:00:00', '2021-09-16 05:00:00', '2021-09-16 06:00:00', '2021-09-16 07:00:00', '2021-09-16 08:00:00', '2021-09-16 09:00:00', '2021-09-16 10:00:00', '2021-09-16 11:00:00', '2021-09-16 12:00:00', '2021-09-16 13:00:00', '2021-09-16 14:00:00', '2021-09-16 15:00:00', '2021-09-16 16:00:00', '2021-09-16 17:00:00', '2021-09-16 18:00:00', '2021-09-16 19:00:00', '2021-09-16 20:00:00', '2021-09-16 21:00:00', '2021-09-16 22:00:00', '2021-09-16 23:00:00', '2021-09-17 00:00:00', '2021-09-17 01:00:00', '2021-09-17 02:00:00', '2021-09-17 03:00:00', '2021-09-17 04:00:00', '2021-09-17 05:00:00', '2021-09-17 06:00:00', '2021-09-17 07:00:00', '2021-09-17 08:00:00', '2021-09-17 09:00:00', '2021-09-17 10:00:00', '2021-09-17 11:00:00', '2021-09-17 12:00:00', '2021-09-17 13:00:00', '2021-09-17 14:00:00', '2021-09-17 15:00:00', '2021-09-17 16:00:00', '2021-09-17 17:00:00', '2021-09-17 18:00:00', '2021-09-17 19:00:00', '2021-09-17 20:00:00', '2021-09-17 21:00:00', '2021-09-17 22:00:00', '2021-09-17 23:00:00', '2021-09-18 00:00:00', '2021-09-18 01:00:00', '2021-09-18 02:00:00', '2021-09-18 03:00:00', '2021-09-18 04:00:00', '2021-09-18 05:00:00', '2021-09-18 06:00:00', '2021-09-18 07:00:00', '2021-09-18 08:00:00', '2021-09-18 09:00:00', '2021-09-18 10:00:00', '2021-09-18 11:00:00', '2021-09-18 12:00:00', '2021-09-18 13:00:00', '2021-09-18 14:00:00', '2021-09-18 15:00:00', '2021-09-18 16:00:00', '2021-09-18 17:00:00', '2021-09-18 18:00:00', '2021-09-18 19:00:00', '2021-09-18 20:00:00', '2021-09-18 21:00:00', '2021-09-18 22:00:00', '2021-09-18 23:00:00', '2021-09-19 00:00:00', '2021-09-19 01:00:00', '2021-09-19 02:00:00', '2021-09-19 03:00:00', '2021-09-19 04:00:00', '2021-09-19 05:00:00', '2021-09-19 06:00:00', '2021-09-19 07:00:00', '2021-09-19 08:00:00', '2021-09-19 09:00:00', '2021-09-19 10:00:00', '2021-09-19 11:00:00', '2021-09-19 12:00:00', '2021-09-19 13:00:00', '2021-09-19 14:00:00', '2021-09-19 15:00:00', '2021-09-19 16:00:00', '2021-09-19 17:00:00', '2021-09-19 18:00:00', '2021-09-19 19:00:00', '2021-09-19 20:00:00', '2021-09-19 21:00:00', '2021-09-19 22:00:00', '2021-09-19 23:00:00', '2021-09-20 00:00:00', '2021-09-20 01:00:00', '2021-09-20 02:00:00', '2021-09-20 03:00:00', '2021-09-20 04:00:00', '2021-09-20 05:00:00', '2021-09-20 06:00:00', '2021-09-20 07:00:00', '2021-09-20 08:00:00', '2021-09-20 09:00:00', '2021-09-20 10:00:00', '2021-09-20 11:00:00', '2021-09-20 12:00:00', '2021-09-20 13:00:00', '2021-09-20 14:00:00', '2021-09-20 15:00:00', '2021-09-20 16:00:00', '2021-09-20 17:00:00', '2021-09-20 18:00:00', '2021-09-20 19:00:00', '2021-09-20 20:00:00', '2021-09-20 21:00:00', '2021-09-20 22:00:00', '2021-09-20 23:00:00', '2021-09-21 00:00:00', '2021-09-21 01:00:00', '2021-09-21 02:00:00', '2021-09-21 03:00:00', '2021-09-21 04:00:00', '2021-09-21 05:00:00', '2021-09-21 06:00:00', '2021-09-21 07:00:00', '2021-09-21 08:00:00', '2021-09-21 09:00:00', '2021-09-21 10:00:00', '2021-09-21 11:00:00', '2021-09-21 12:00:00', '2021-09-21 13:00:00', '2021-09-21 14:00:00', '2021-09-21 15:00:00', '2021-09-21 16:00:00', '2021-09-21 17:00:00', '2021-09-21 18:00:00', '2021-09-21 19:00:00', '2021-09-21 20:00:00', '2021-09-21 21:00:00', '2021-09-21 22:00:00', '2021-09-21 23:00:00', '2021-09-22 00:00:00', '2021-09-22 01:00:00', '2021-09-22 02:00:00', '2021-09-22 03:00:00', '2021-09-22 04:00:00', '2021-09-22 05:00:00', '2021-09-22 06:00:00', '2021-09-22 07:00:00', '2021-09-22 08:00:00', '2021-09-22 09:00:00', '2021-09-22 10:00:00', '2021-09-22 11:00:00', '2021-09-22 12:00:00', '2021-09-22 13:00:00', '2021-09-22 14:00:00', '2021-09-22 15:00:00', '2021-09-22 16:00:00', '2021-09-22 17:00:00', '2021-09-22 18:00:00', '2021-09-22 19:00:00', '2021-09-22 20:00:00', '2021-09-22 21:00:00', '2021-09-22 22:00:00', '2021-09-22 23:00:00', '2021-09-23 00:00:00', '2021-09-23 01:00:00', '2021-09-23 02:00:00', '2021-09-23 03:00:00', '2021-09-23 04:00:00', '2021-09-23 05:00:00', '2021-09-23 06:00:00', '2021-09-23 07:00:00', '2021-09-23 08:00:00', '2021-09-23 09:00:00', '2021-09-23 10:00:00', '2021-09-23 11:00:00', '2021-09-23 12:00:00', '2021-09-23 13:00:00', '2021-09-23 14:00:00', '2021-09-23 15:00:00', '2021-09-23 16:00:00', '2021-09-23 17:00:00', '2021-09-23 18:00:00', '2021-09-23 19:00:00', '2021-09-23 20:00:00', '2021-09-23 21:00:00', '2021-09-23 22:00:00', '2021-09-23 23:00:00', '2021-09-24 00:00:00', '2021-09-24 01:00:00', '2021-09-24 02:00:00', '2021-09-24 03:00:00', '2021-09-24 04:00:00', '2021-09-24 05:00:00', '2021-09-24 06:00:00', '2021-09-24 07:00:00', '2021-09-24 08:00:00', '2021-09-24 09:00:00', '2021-09-24 10:00:00', '2021-09-24 11:00:00', '2021-09-24 12:00:00', '2021-09-24 13:00:00', '2021-09-24 14:00:00', '2021-09-24 15:00:00', '2021-09-24 16:00:00', '2021-09-24 17:00:00', '2021-09-24 18:00:00', '2021-09-24 19:00:00', '2021-09-24 20:00:00', '2021-09-24 21:00:00', '2021-09-24 22:00:00', '2021-09-24 23:00:00', '2021-09-25 00:00:00', '2021-09-25 01:00:00', '2021-09-25 02:00:00', '2021-09-25 03:00:00', '2021-09-25 04:00:00', '2021-09-25 05:00:00', '2021-09-25 06:00:00', '2021-09-25 07:00:00', '2021-09-25 08:00:00', '2021-09-25 09:00:00', '2021-09-25 10:00:00', '2021-09-25 11:00:00', '2021-09-25 12:00:00', '2021-09-25 13:00:00', '2021-09-25 14:00:00', '2021-09-25 15:00:00', '2021-09-25 16:00:00', '2021-09-25 17:00:00', '2021-09-25 18:00:00', '2021-09-25 19:00:00', '2021-09-25 20:00:00', '2021-09-25 21:00:00', '2021-09-25 22:00:00', '2021-09-25 23:00:00', '2021-09-26 00:00:00', '2021-09-26 01:00:00', '2021-09-26 02:00:00', '2021-09-26 03:00:00', '2021-09-26 04:00:00', '2021-09-26 05:00:00', '2021-09-26 06:00:00', '2021-09-26 07:00:00', '2021-09-26 08:00:00', '2021-09-26 09:00:00', '2021-09-26 10:00:00', '2021-09-26 11:00:00', '2021-09-26 12:00:00', '2021-09-26 13:00:00', '2021-09-26 14:00:00', '2021-09-26 15:00:00', '2021-09-26 16:00:00', '2021-09-26 17:00:00', '2021-09-26 18:00:00', '2021-09-26 19:00:00', '2021-09-26 20:00:00', '2021-09-26 21:00:00', '2021-09-26 22:00:00', '2021-09-26 23:00:00', '2021-09-27 00:00:00', '2021-09-27 01:00:00', '2021-09-27 02:00:00', '2021-09-27 03:00:00', '2021-09-27 04:00:00', '2021-09-27 05:00:00', '2021-09-27 06:00:00', '2021-09-27 07:00:00', '2021-09-27 08:00:00', '2021-09-27 09:00:00', '2021-09-27 10:00:00', '2021-09-27 11:00:00', '2021-09-27 12:00:00', '2021-09-27 13:00:00', '2021-09-27 14:00:00', '2021-09-27 15:00:00', '2021-09-27 16:00:00', '2021-09-27 17:00:00', '2021-09-27 18:00:00', '2021-09-27 19:00:00', '2021-09-27 20:00:00', '2021-09-27 21:00:00', '2021-09-27 22:00:00', '2021-09-27 23:00:00', '2021-09-28 00:00:00', '2021-09-28 01:00:00', '2021-09-28 02:00:00', '2021-09-28 03:00:00', '2021-09-28 04:00:00', '2021-09-28 05:00:00', '2021-09-28 06:00:00', '2021-09-28 07:00:00', '2021-09-28 08:00:00', '2021-09-28 09:00:00', '2021-09-28 10:00:00', '2021-09-28 11:00:00', '2021-09-28 12:00:00', '2021-09-28 13:00:00', '2021-09-28 14:00:00', '2021-09-28 15:00:00', '2021-09-28 16:00:00', '2021-09-28 17:00:00', '2021-09-28 18:00:00', '2021-09-28 19:00:00', '2021-09-28 20:00:00', '2021-09-28 21:00:00', '2021-09-28 22:00:00', '2021-09-28 23:00:00', '2021-09-29 00:00:00', '2021-09-29 01:00:00', '2021-09-29 02:00:00', '2021-09-29 03:00:00', '2021-09-29 04:00:00', '2021-09-29 05:00:00', '2021-09-29 06:00:00', '2021-09-29 07:00:00', '2021-09-29 08:00:00', '2021-09-29 09:00:00', '2021-09-29 10:00:00', '2021-09-29 11:00:00', '2021-09-29 12:00:00', '2021-09-29 13:00:00', '2021-09-29 14:00:00', '2021-09-29 15:00:00', '2021-09-29 16:00:00', '2021-09-29 17:00:00', '2021-09-29 18:00:00', '2021-09-29 19:00:00', '2021-09-29 20:00:00', '2021-09-29 21:00:00', '2021-09-29 22:00:00', '2021-09-29 23:00:00', '2021-09-30 00:00:00', '2021-09-30 01:00:00', '2021-09-30 02:00:00', '2021-09-30 03:00:00', '2021-09-30 04:00:00', '2021-09-30 05:00:00', '2021-09-30 06:00:00', '2021-09-30 07:00:00', '2021-09-30 08:00:00', '2021-09-30 09:00:00', '2021-09-30 10:00:00', '2021-09-30 11:00:00', '2021-09-30 12:00:00', '2021-09-30 13:00:00', '2021-09-30 14:00:00', '2021-09-30 15:00:00', '2021-09-30 16:00:00', '2021-09-30 17:00:00', '2021-09-30 18:00:00', '2021-09-30 19:00:00', '2021-09-30 20:00:00', '2021-09-30 21:00:00', '2021-09-30 22:00:00', '2021-09-30 23:00:00', '2021-10-01 00:00:00', '2021-10-01 01:00:00', '2021-10-01 02:00:00', '2021-10-01 03:00:00', '2021-10-01 04:00:00', '2021-10-01 05:00:00', '2021-10-01 06:00:00', '2021-10-01 07:00:00', '2021-10-01 08:00:00', '2021-10-01 09:00:00')
  AND   BINARY h.model IN ('CTRECv1.6_RWRFgrid', 'RWRF_cal', 'RWRF_ladj')
  AND   BINARY h.fcst_thresh IN ('>=20')
  AND   BINARY ld.fcst_lead IN ('0', '10000', '20000', '30000', '40000', '50000', '60000', '70000', '80000', '90000', '100000')
  AND   BINARY h.fcst_var = 'MOSA'
  AND ld.stat_header_id = h.stat_header_id;

