src: |
  SELECT t_ghm.oid,
      t_ghm_v.oid AS to_id
     FROM pmsi.t_ghm,
      pmsi.t_ghm t_ghm_v
    WHERE substr(t_ghm.code::text, 6, 1) = 'W'::text AND substr(t_ghm.code::text, 1, 5) = substr(t_ghm_v.code::text, 1, 5);