my code stock.com

marcus.sacramento

QR REABERTURA FABRICA
by marcus.sacramento

Script para Extração do número de reaberturas por agente solução

Snippet options

Download: Download snippet as qr-reabertura-fabrica.sql.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

--Reabertura CLY
SELECT chamado.C536870990, COUNT (DISTINCT chamado.c1)
  FROM t92 statusResolvido, t90 chamado
 WHERE chamado.c1 = statusResolvido.c536870913 --> ID do Chamado
   AND statusResolvido.C536870914 IN (7, 9) --> Resolvido/Cancelado
   AND EXISTS ( SELECT 1 --> Status Posterior Diferente de Fechado/Resolvido/Cancelado
                  FROM t92 statusReaberto
                 WHERE TO_DATE ('31/12/1969 21:00:00', 'DD/MM/YYYY HH24:MI:SS') + statusReaberto.C536870917 / 86400 BETWEEN TO_DATE('01/08/2011 00:00:00', 'DD/MM/YYYY HH24:MI:SS') AND TO_DATE('08/08/2011 00:00:00', 'DD/MM/YYYY HH24:MI:SS') --> Data Reabertura
                   AND statusReaberto.c536870913 = statusResolvido.c536870913 --> ID do Chamado
                   AND statusResolvido.C536870917 = statusReaberto.C536870916 --> Data Fim Solução = Data Início Reabertura
                   AND statusReaberto.C536870914 < 7 ) --> Status Reabertura <> Fechado/Resolvido/Cancelado
   AND chamado.C536870990 LIKE 'OPERACAO_INV_%' --> Filas de Investigação
group by chamado.C536870990

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.