Advertisement
Guest User

Untitled

a guest
Nov 19th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. SELECT
  2. Pessoa.NomePessoa as GarcomAtd,
  3. Atendimento.NumeroMesa,
  4. Cardapio.NomeItem,
  5. AtendimentoItem.Quantidade,
  6. AtendimentoItem.ValorItem,
  7. AtendimentoItem.ValorTotal,
  8. AtendimentoInterno.DataHoraAtendimento,
  9. pes.NomePessoa as GarcomAtdIterno,
  10. CASE
  11. WHEN bar.IdAtendimentoItem IS NULL THEN 'COZINHA'
  12. ELSE 'BAR'
  13. END as LocalAtendimentoInterno
  14.  
  15. FROM Atendimento
  16. INNER JOIN Pessoa on Atendimento.IdPessoa = Pessoa.IdPessoa
  17. INNER JOIN AtendimentoItem on AtendimentoItem.IdAtendimento = Atendimento.IdAtendimento
  18. INNER JOIN Cardapio on Cardapio.IdCardapio = AtendimentoItem.IdCardapio
  19. INNER JOIN AtendimentoInterno on AtendimentoInterno.IdAtendimentoItem = AtendimentoItem.IdAtendimentoItem
  20. LEFT JOIN Pessoa as pes on pes.IdPessoa = AtendimentoInterno.IdPessoa
  21. LEFT JOIN AtendimentoInternoBar as bar on bar.IdAtendimentoItem = AtendimentoInterno.IdAtendimentoItem
  22. LEFT JOIN AtendimentoInternoCozinha as cozinha on cozinha.IdAtendimentoItem = AtendimentoInterno.IdAtendimentoItem
  23.  
  24. WHERE Pessoa.NomePessoa like '%a%' AND NumeroMesa in(1,2,3,4,5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement