Jump to content
Tatiana_araujo

Bd oracle - qtde turma/func ativos mes

Recommended Posts

Pessoal , por favor, estou tentando  criar a sentença , porem quando preencho o parâmetro para gerar o ano todo,  os números de qtde de funcionários ativos distorce. Preciso considerar o total de ativos e carga horaria em cada mês. (BANCO DE DADOS ORACLE)

SELECT 

     TO_CHAR(VTURMAS.DTINICIO,'MM/YYYY') AS MES_ANO ,
     PFUNC.CODFILIAL,
     SUM(VTURMAS.CARGAHORARIA) AS CH,
     COUNT (PFUNC.CHAPA) AS ATIVOS
      
     FROM    PFUNC
     
     INNER JOIN VTURMAS
     ON         PFUNC.CODCOLIGADA=VTURMAS.CODCOLIGADA
     AND        PFUNC.CODFILIAL=VTURMAS.CODFILIAL


     INNER JOIN PPESSOA
     ON PPESSOA.CODIGO=PFUNC.CODPESSOA
     
     INNER JOIN VTURMA 
     ON         VTURMA.CODCOLIGADA=PFUNC.CODCOLIGADA
     AND        VTURMA.CODPESSOA=PPESSOA.CODIGO
     AND        VTURMA.CODCOLIGADA=VTURMAS.CODCOLIGADA
     AND        VTURMA.CODTURMA=VTURMAS.CODTURMA
                         
     WHERE    
     ---PFUNC.DATAADMISSAO>='01/07/2020' 
     ---AND
     ---      PFUNC.DATAADMISSAO<='31/12/2020' 
     ----AND
              PFUNC.CODSITUACAO  <> ('D')
     
                
     AND     VTURMAS.DTINICIO>='01/01/2020'

     AND     VTURMAS.DTTERMINO<='31/12/2020'

GROUP BY   TO_CHAR(VTURMAS.DTINICIO,'MM/YYYY') ,
 PFUNC.CODFILIAL
 ORDER BY 1,2
 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.