CREATE OR REPLACE VIEW food600.skasaras_set
 AS
 SELECT aras_set.rastr,
    aras_set.kdy,
    aras_set.kdo,
    aras_set.c_druh,
    aras_set.id,
    skupiny.druh::character(30)
   FROM food600.aras_set
     LEFT JOIN food600.skupiny ON aras_set.c_druh = skupiny.c_druh AND aras_set.c_data = skupiny.c_data
  WHERE aras_set.c_druh <> '-1'::integer AND aras_set.c_druh <> 0
UNION
 SELECT aras_set.rastr,
    aras_set.kdy,
    aras_set.kdo,
    aras_set.c_druh,
    aras_set.id,
    'TIP'::character(30) AS druh
   FROM food600.aras_set
  WHERE aras_set.c_druh = '-1'::integer;
