Jump to content
Seja Membro VIP - Remova Banners de Propagandas, Tenha Liberado Qualquer Download, Além de Acessos em Áreas Exclusivas!! ×

Dúvida select planilha .net


Recommended Posts


  • Topic Count:  3
  • Topics Per Day:  0.01
  • Content Count:  11
  • Content Per Day:  0.04
  • Reputation:   0
  • Achievement Points:  72
  • Solved Content:  0
  • Days Won:  0
  • Status:  Offline
  • Age:  24
  • Device:  Windows

Bom dia pessoal, tudo bem?

 

Galera estou tentando montar uma planilha .net para trazer todos colaboradores com batidas de ponto que trabalham 7 dias seguidos

 

Estou fazendo seguinte select:

 

Porém quando tento acrescentar em uma planilha .net ou cadastrar na consulta ele não me deixa gera erro: 

Esta consulta apresentou um erro ao ser executada, deseja salvá-la assim mesmo?

Detalhes  técnicos: ORA-00923: palavra-chave FROM não localizada onde esperada

 

Alguém sabe o que poderia sre ? 

 

SELECT

B.NOME AS "nome",

A.CHAPA AS "Chapa",

EXTRACT(MONTH FROM A."DATA") AS "Mês",

EXTRACT(YEAR FROM A."DATA") AS "Ano",

COUNT(DISTINCT TRUNC(A."DATA")) AS "Dias Trabalhados"

FROM ABATFUN A

INNER JOIN PFUNC B ON A.CHAPA = B.CHAPA

WHERE B.CHAPA = :chapa

AND EXTRACT(MONTH FROM A."DATA") = :MES

AND EXTRACT(YEAR FROM A."DATA") = :ANO

GROUP BY B.NOME, A.CHAPA, EXTRACT(YEAR FROM A."DATA"), EXTRACT(MONTH FROM A."DATA"), TO_CHAR(A."DATA", 'IYYY-IW')

HAVING COUNT(DISTINCT TRUNC(A."DATA")) = 7

ORDER BY B.NOME;

 

 

 

Edited by Igor Gomes
Link to comment
Share on other sites


  • Topic Count:  59
  • Topics Per Day:  0.01
  • Content Count:  824
  • Content Per Day:  0.16
  • Reputation:   108
  • Achievement Points:  4,812
  • Solved Content:  0
  • Days Won:  75
  • Status:  Offline
  • Age:  61
  • Device:  Windows

Tenta assim:

SELECT B.NOME                  AS NOME,
       A.CHAPA                 AS CHAPA,
       Datepart(MONTH, A.DATA) AS MES,
       Datepart(YEAR, A.DATA)  AS ANO,
       Count(A.DATA)           AS DIASTRALHADO
FROM   ABATFUN AS A WITH (NOLOCK)
       INNER JOIN PFUNC AS B WITH (NOLOCK)
               ON A.CHAPA = B.CHAPA
WHERE  B.CHAPA = :CHAPA
       AND Datepart(MONTH, A.DATA) = :MES
       AND Datepart(YEAR, A.DATA) = :ANO
GROUP  BY B.NOME,
          A.CHAPA,
          Datepart(YEAR, A.DATA),
          Datepart(MONTH, A.DATA)
HAVING Count(A.DATA) = 7
ORDER  BY B.NOME 

Link to comment
Share on other sites


  • Topic Count:  59
  • Topics Per Day:  0.01
  • Content Count:  824
  • Content Per Day:  0.16
  • Reputation:   108
  • Achievement Points:  4,812
  • Solved Content:  0
  • Days Won:  75
  • Status:  Offline
  • Age:  61
  • Device:  Windows

Vi agora que teu banco é ORACLE.   Enviei select do MS SQL Server.

Link to comment
Share on other sites


  • Topic Count:  3
  • Topics Per Day:  0.01
  • Content Count:  11
  • Content Per Day:  0.04
  • Reputation:   0
  • Achievement Points:  72
  • Solved Content:  0
  • Days Won:  0
  • Status:  Offline
  • Age:  24
  • Device:  Windows

@omar tentei executar conforme me orientou e mesmo assim retornei com o mesmo erro

 

Detalhes  técnicos: ORA-00923: palavra-chave FROM não localizada onde esperada
 

Link to comment
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.