Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1.  
  2. create view "Melhores_Piores_Clientes" as
  3. select a.codcliente, a.nome, sum(s.preço) montante
  4. from cliente a, servico s
  5. where s.codservico in (
  6. select ordem_viatura_matricula
  7. from "Ordem/Servico"
  8. where ordem_viatura_matricula in (
  9. select matricula
  10. from viatura
  11. where cliente_codcliente = a.codcliente))
  12. group by a.codcliente, a.nome;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement