Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select t.n_det,t.n_izd,date_part('year', t.date_post) as datt, sum(t.kol-rez.koll) as summa
- from spj1 t, (select w.n_izd,q.n_det,date_part('year', w.date_part) as datt, SUM(w.kol*q.kol)
- as koll from w inner join q on w.n_izd=q.n_izd group by 1,2,3) as rez
- where rez.n_izd=t.n_izd and rez.n_det=t.n_det and datt=rez.datt group by 1,2,3
- order by 3,1,2;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement