Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select pob.pID,pob.zeme,
- (
- select count(distinct ob.oID)
- from test.Objednavka ob
- join test.Polozka po on po.oID=ob.oID
- join test.Zbozi zb on zb.zID=po.zID
- join test.Zamestnanec za on za.zaID=ob.zaID
- where po.cena<zb.aktualni_cena and pob.pID=za.pID
- ),
- (
- select count(pocet)
- from
- (
- select sum(po.kusu*po.cena) as [pocet]
- from test.Objednavka ob
- join test.Polozka po on po.oID=ob.oID
- join test.Zamestnanec za on za.zaID=ob.zaID
- where pob.pID=za.pID
- group by ob.oID
- having sum(po.kusu*po.cena)>80000
- )
- Tabulka
- )
- from test.Pobocka pob
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement