Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1.  
  2. select pob.pID,pob.zeme,
  3. (
  4. select count(distinct ob.oID)
  5. from test.Objednavka ob
  6. join test.Polozka po on po.oID=ob.oID
  7. join test.Zbozi zb on zb.zID=po.zID
  8. join test.Zamestnanec za on za.zaID=ob.zaID
  9. where po.cena<zb.aktualni_cena and pob.pID=za.pID
  10. ),
  11. (
  12. select count(pocet)
  13. from
  14. (
  15. select sum(po.kusu*po.cena) as [pocet]
  16. from test.Objednavka ob
  17. join test.Polozka po on po.oID=ob.oID
  18. join test.Zamestnanec za on za.zaID=ob.zaID
  19. where pob.pID=za.pID
  20. group by ob.oID
  21. having sum(po.kusu*po.cena)>80000
  22. )
  23. Tabulka
  24. )
  25. from test.Pobocka pob
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement