CREATE OR REPLACE VIEW food600.ssk__fin
 AS
 SELECT sk__fin.c_uzaverka,
    sk__fin.ucet,
    sk__fin.autor,
    sk__fin.u_cas,
    sk__fin.u_minut,
    sk__fin.mutace,
    sk__fin.cas_atrib,
    sk__fin.pocet_h,
    sk__fin.stul,
    sk__fin.text_sleva,
    sk__fin.text_link,
    sk__fin.ducis,
    sk__fin.lim_datum,
    sk__fin.id_limit,
    sk__fin.round50,
    sk__fin.pohladavka,
    sk__fin.c_data,
    sk__fin.id_den,
    sk__fin.id_chod,
    sk__fin.id_slave,
    sk__fin.id_miestnost,
    sk__fin.u_datetime,
    sk__fin.loyalman,
    sk__fin.c_uzav_cis,
    sk__fin.additional_data
   FROM food600.sk__fin
UNION
 SELECT sk__fin.c_uzaverka,
    100000 + sk__fin.ucet AS ucet,
    sk__fin.autor,
    sk__fin.u_cas,
    sk__fin.u_minut,
    sk__fin.mutace,
    sk__fin.cas_atrib,
    sk__fin.pocet_h,
    sk__fin.stul,
    sk__fin.text_sleva,
    sk__fin.text_link,
    sk__fin.ducis,
    sk__fin.lim_datum,
    sk__fin.id_limit,
    sk__fin.round50,
    sk__fin.pohladavka,
    sk__fin.c_data,
    sk__fin.id_den,
    sk__fin.id_chod,
    sk__fin.id_slave,
    sk__fin.id_miestnost,
    sk__fin.u_datetime,
    sk__fin.loyalman,
    sk__fin.c_uzav_cis,
    sk__fin.additional_data
   FROM food600.sk__fin
     JOIN food600.sskpltkompez ON sk__fin.c_uzaverka = sskpltkompez.c_uzaverka AND sk__fin.ucet = sskpltkompez.ucet
  WHERE sskpltkompez.cena_pl <> 0::numeric;

