Skip to content

Instantly share code, notes, and snippets.

@instplanet
Created March 12, 2019 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save instplanet/5d7bd9eab1d07ce8b29867f21176e66c to your computer and use it in GitHub Desktop.
Save instplanet/5d7bd9eab1d07ce8b29867f21176e66c to your computer and use it in GitHub Desktop.
SELECT
chamado.cdchamado as 'COD. CHAMADO',
UPPER(usuario_abertura.nome) as 'USU. ABERTURA',
UPPER(usuario_fechamento.nome) as 'USU. FECHAMENTO',
chamado.status as 'STATUS CHAMADO',
tipo_chamado.descricao as 'TIPO CHAMADO',
chamado.dthi as 'DATA ABERTURA',
chamado.dthf as 'DATA FECHAMENTO'
FROM chamado
INNER JOIN usuario usuario_fechamento on usuario_fechamento.cdusuario = chamado.cdusuariof
INNER JOIN usuario usuario_abertura on usuario_abertura.cdusuario = chamado.cdusuario
INNER JOIN tipo_chamado on tipo_chamado.cdtipo_chamado = chamado.cdtipo_chamado
LEFT JOIN chamado_os on chamado.cdchamado = chamado_os.cdchamado
LEFT JOIN os on chamado_os.cdos = os.cdos
WHERE chamado.status = 3
AND $__timeFilter(chamado.dthf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment