CREATE OR REPLACE VIEW food600.szoznamuctov2 AS 
 SELECT sk__plt.idriadok AS id,
    sk__plt.ucet,
    sum(sk__plt.cena_pl) AS cena_pl,
    sk__plt.c_uzaverka,
    sk__plt.druh_pl,
    sk__uza.uzaverka,
    sk__uza.id_kas,
    sk__fin.stul,
    sk__fin.autor,
    sksez.uct_den
   FROM food600.sk__plt
     LEFT JOIN food600.sk__uza ON sk__plt.c_uzaverka = sk__uza.idriadok
     LEFT JOIN food600.sk__fin ON sk__plt.ucet = sk__fin.ucet AND sk__plt.c_uzaverka = sk__fin.c_uzaverka
     LEFT JOIN ( SELECT DISTINCT sk__sez.c_uzaverka,
            sk__sez.uct_den
           FROM food600.sk__sez) sksez ON sksez.c_uzaverka = sk__uza.idriadok
  GROUP BY sk__plt.ucet, sk__uza.uzaverka, sk__uza.id_kas, sk__plt.c_uzaverka, sk__fin.stul, sk__fin.autor, sksez.uct_den, sk__plt.druh_pl, sk__plt.idriadok
  ORDER BY sk__uza.id_kas, sk__uza.uzaverka, sk__plt.ucet;
