Jump to content
Fórum Script Brasil
  • 0

(Resolvido) Select com EXTRACT


Question

Boa tarde,

estou com este Select e gostaria de colocar um Extract Month dentro dele será possível?

SELECT L1.* FROM apontamento As L1
INNER JOIN (
SELECT NUM_OF, MAX(Datahora) As UltimaData
FROM apontamento GROUP BY NUM_OF) As L2
ON L1.NUM_OF = L2.NUM_OF AND L1.Datahora = L2.UltimaData
where
L1.pa <> 0 and
L1.datahora >= :DataIni and
L1.datahora <= :DataFim
ORDER BY L1.datahora

Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0
SELECT L1.* FROM apontamento As L1
INNER JOIN (
SELECT EXTRACT(MONTH FROM Datahora) as Mes, NUM_OF, MAX(Datahora) As UltimaData
FROM apontamento GROUP BY NUM_OF) As L2
ON L1.NUM_OF = L2.NUM_OF AND L1.Datahora = L2.UltimaData
where
L1.pa <> 0 and
L1.datahora >= :DataIni and
L1.datahora <= :DataFim
ORDER BY L1.datahora 

Tente assim ...  se não funcionar, veja como utilizar a função no manual do Firebird

abraço

 

Link to post
Share on other sites
  • 0

agora estou tentando somar as linhas pelo mes

Obs: somar quantidades de um campo em um registro  é uma coisa ... contar um registro de campo indedendente da quantidade é outra

se é count então, veja esses links

https://www.google.com/search?q=select+count+firebird&o que=select+count+firebird&aqs=chrome..69i57j0i22i30l3.9257j0j15&sourceid=chrome&ie=UTF-8

abraço

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
Answer this question...

×   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.



  • Forum Statistics

    • Total Topics
      149411
    • Total Posts
      645902
×
×
  • Create New...