6
Good morning, I need to know a percent variation of last month’s job records for the task logs you did this month. For this I need to compare with the current day, for example.
If today were 15/10/2015 I need to count how many tasks have been opened between 01/09/2015 until 15/09/2015 remembering that this needs to be done automatically, that is, the 15th mentioned in the example, has to be picked the date of the machine. I just got into it:
select *
from Solicitacao
where UsuIDGrupoRespConclusao = 2655 and
DATEPART(m, SolDataFechamento) = DATEPART(m, DATEADD(m, -1, getdate()))
AND DATEPART(yyyy, SolDataFechamento) = DATEPART(yyyy, DATEADD(m, -1, getdate()))
This query returns the open tasks last month INTEGER, as I need the variation, I have to compare from the beginning until the current day of last month.
OBS: I am using SQL SERVER 2008
Man, thanks too, it worked EXACTLY!
– Vinícius Fernandes