CREATE OR REPLACE VIEW food600.sdonklapky
 AS
 SELECT kl_don.strana,
    kl_don.pozice,
    kl_don.caption,
    kl_don.typ,
    kl_don.vazba,
    kl_don.c_data,
    kl_don.c_karty,
    kl_don.id,
    karty.nazev
   FROM food600.kl_don
     JOIN food600.karty ON kl_don.c_karty = karty.c_karty AND kl_don.c_data = karty.c_data
  WHERE kl_don.typ = 'item'::bpchar AND kl_don.c_karty <> 0
UNION
 SELECT kl_don.strana,
    kl_don.pozice,
    kl_don.caption,
    kl_don.typ,
    kl_don.vazba,
    kl_don.c_data,
    kl_don.c_karty,
    kl_don.id,
    kl_don.caption AS nazev
   FROM food600.kl_don
  WHERE kl_don.typ = 'page'::bpchar;
