CREATE OR REPLACE VIEW food600.svydejpolozmenaz
 AS
 SELECT sklad.c_karty,
    sklad.c_stredisk,
    sklad.zustatek,
    sklad.c_data
   FROM food600.sklad
     LEFT JOIN food600.karty ON sklad.c_karty = karty.c_karty
  WHERE sklad.zustatek > 0 AND karty.c_druhk = 0
UNION
 SELECT polozky.c_karty,
    (-999) AS c_stredisk,
    999999.9999::numeric(20,10) AS zustatek,
    polozky.c_data
   FROM food600.polozky
UNION
 SELECT sklad.c_karty,
    sklad.c_stredisk,
    sklad.zustatek,
    sklad.c_data
   FROM food600.sklad
     LEFT JOIN food600.karty ON sklad.c_karty = karty.c_karty
  WHERE sklad.zustatek > 0 AND karty.c_druhk > 0 AND NOT (sklad.c_karty IN ( SELECT polozky.c_karty
           FROM food600.polozky));
